Skip to content

kimulaco/svg-path-command

Repository files navigation

svg-path-command

npm version Test Status License MIT codecov

SVG path data parser library.

Install

npm i svg-path-command

Use

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

License

MIT License.