svg-path-parser is a JavaScript library designed for parsing SVG `d` attribute path strings into a structured array of command objects. It is currently at version 1.1.0, with its last major update in 2020, suggesting it is in a maintenance phase rather than active development. The library provides a programmatic way to interpret complex SVG path data, converting shorthand notations (e.g., multiple consecutive `L` commands) into individual, distinct command objects. A key differentiator is its ability to convert all path commands to their absolute coordinate equivalents using the `makeAbsolute` function, which is useful for simplifying subsequent geometric calculations or transformations. It leverages a PEG.js grammar for robust parsing and is primarily designed for Node.js environments, shipping as a CommonJS module.
npm install svg-path-parserVerified import paths — ran on the pinned version, not inferred.
Parses a complex SVG path string and then converts all commands to their absolute coordinate equivalents, logging the modified command array.
Update code to access command parameters directly (e.g., `command.x` instead of `command.args[0]`). Review the output format for all command types.
Upgrade to v0.0.4 or newer to benefit from the unrolled grammar descriptions that resolve this issue.
Upgrade to v1.0.1 or newer to ensure all subpaths in an SVG 'd' attribute are correctly parsed and returned.
Upgrade to v0.0.2 or newer to ensure correct parsing of floating-point numbers and proper handling of `moveto` command sequences.
After v1.0.0, command arguments are direct properties on the command object (e.g., `command.x`, `command.y`). Update your code to access these properties directly instead of `command.args[index]`.
Upgrade `svg-path-parser` to version 0.0.4 or later, which includes a fix for this issue by unrolling recursive grammar descriptions.
Upgrade `svg-path-parser` to version 1.0.1 or newer to resolve the bug and correctly retrieve all subpaths.
No dependency data recorded yet.