SVG path data parser library.
npm i svg-path-command
import { parse } from 'svg-path-command'
const pathCommand = parse('M2,8 L5,2 L8,8')
console.log(pathCommand.stringify()) // 'M2 8 L5 2 L8 8'
pathCommand.commands[0].updateParams([4, 16])
pathCommand.commands[1].updateValue({
x: 10,
y: 4,
})
console.log(pathCommand.stringify()) // 'M4 16 L10 4 L8 8'
See API Doc for detailed usage