path-data-parser is a lightweight and tree-shakable JavaScript library designed for parsing and manipulating SVG path data strings. It currently stands at version 0.1.0, indicating a stable but early-stage release, likely following an 'as-needed' or infrequent release cadence given its focused utility. Its key differentiators include its small footprint and a direct API offering four core functions: `parsePath` for converting SVG path strings into an array of segment objects, `serialize` for converting segment arrays back into path strings, `absolutize` for transforming relative path commands to absolute ones, and `normalize` for simplifying path segments to only M, L, C, and Z commands. This normalization is particularly useful for rendering SVG paths on non-SVG graphics platforms like Canvas, providing a consistent data structure for further processing.
npm install path-data-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing, absolutizing, serializing, and normalizing SVG path data. It shows how to convert a path string to segments, modify them (e.g., to absolute coordinates), and convert them back to a string, or simplify them to M, L, C, Z commands for other graphics contexts.
Use ES module import syntax (`import { ... } from 'path-data-parser'`) and ensure your project or runtime environment (e.g., Node.js with 'type': 'module' in package.json, or a bundler like webpack/Rollup) is configured for ES modules.Review release notes carefully when upgrading between 0.x.x versions, as minor versions might not strictly adhere to semantic versioning until 1.0.0.
Ensure that input path data strings conform to the SVG Path Data specification (e.g., correct command syntax, valid number sequences). Pre-validate user-provided path data if necessary.
Ensure your Node.js project's `package.json` contains `"type": "module"` or use a bundler (like Webpack or Rollup) to transpile your code if targeting a CommonJS environment.
The library is ES module only. Use `import { parsePath } from 'path-data-parser';` in a properly configured ES module context. Do not use `require()`.Carefully review the SVG path data string to ensure it strictly follows the SVG Path Data specification. Validate inputs from external sources before passing them to the parser.
No dependency data recorded yet.