1.0.0 • Published 8 years ago

round-svg-path v1.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

round-svg-path

round-svg-path rounds the position of a parsed SVG path to a fixed number of digits. It was extracted from Fontello’s wonderful svgpath toolkit.

Older browsers might require a polyfill for Array.prototype.map.

Install

$ npm install round-svg-path

API

round(path, digits)

Example

var parse = require('parse-svg-path')
var serialize = require('serialize-svg-path')
var round = require('round-svg-path')

var path = parse('M10.25 10.25 L15.25 15.25')
var x = round(path, 1)

serialize(x)
// => 'M10.3 10.3 L15.3 15.3'

License

MIT