What is parse-svg-path?
The parse-svg-path npm package is a utility for parsing SVG path data strings into a more manageable format. This can be useful for manipulating or analyzing SVG paths programmatically.
What are parse-svg-path's main functionalities?
Parsing SVG Path Data
This feature allows you to parse an SVG path data string into an array of commands and parameters. The parsed output is easier to manipulate programmatically.
const parse = require('parse-svg-path');
const pathData = 'M10 10 H 90 V 90 H 10 Z';
const parsedPath = parse(pathData);
console.log(parsedPath);
Other packages similar to parse-svg-path
svg-path-parser
The svg-path-parser package provides similar functionality to parse-svg-path by converting SVG path data strings into a more structured format. It also offers additional features like converting the parsed data back into a string.
svg-pathdata
The svg-pathdata package offers a comprehensive set of tools for parsing, transforming, and encoding SVG path data. It provides more advanced manipulation capabilities compared to parse-svg-path.
path-data-parser
The path-data-parser package is another alternative for parsing SVG path data. It focuses on providing a simple and lightweight solution for converting path data strings into a structured format.
parse-svg-path
A minimal svg path parser. For the delux model see hughsk/svg-path-parser or for the streaming model see nfroidure/SVGPathData.
Installation
- packin:
packin add jkroso/parse-svg-path
- component:
component install jkroso/parse-svg-path
- npm:
npm install parse-svg-path
then in your app:
var parse = require('parse-svg-path')
API
parse(string)
parse an svg path data string. Generates an Array
of commands where each command is an Array of the
form [command, arg1, arg2, ...]
parse('m1 2 3 4')
Running the tests
Just run make
and navigate your browser to the test directory.