{"id":22458256,"url":"https://github.com/ksm2/svg-parse","last_synced_at":"2025-09-15T08:48:47.772Z","repository":{"id":26043498,"uuid":"107188239","full_name":"ksm2/svg-parse","owner":"ksm2","description":"Parses SVG paths to a consumable object and JSON","archived":false,"fork":false,"pushed_at":"2022-12-30T19:26:39.000Z","size":105,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-30T03:37:02.408Z","etag":null,"topics":["json","svg","svg-paths"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksm2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-16T22:08:53.000Z","updated_at":"2021-04-29T06:17:56.000Z","dependencies_parsed_at":"2023-01-14T03:55:37.669Z","dependency_job_id":null,"html_url":"https://github.com/ksm2/svg-parse","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksm2%2Fsvg-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksm2%2Fsvg-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksm2%2Fsvg-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksm2%2Fsvg-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksm2","download_url":"https://codeload.github.com/ksm2/svg-parse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228432558,"owners_count":17918894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","svg","svg-paths"],"created_at":"2024-12-06T08:11:47.958Z","updated_at":"2024-12-06T08:11:48.664Z","avatar_url":"https://github.com/ksm2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svg-parse\nParses SVG paths to a consumable object and JSON\n\n## Installation\n\nUse NPM to install it into your project:\n\n    npm install --save svg-parse\n  \n## Usage\n\n### Parsing\nUse the exported `parse` function to parse an SVG path to JSON:\n\n```js\nconst { parse } = require('svg-parse');\n\nconst path = parse('M10 20 L20 20 h10 Z');\nconsole.dir(path);\n```\n\nThe result will be:\n\n```js\n[ { type: 'moveTo', props: { relative: false, x: 10, y: 20 } },\n  { type: 'lineTo', props: { relative: false, x: 20, y: 20 } },\n  { type: 'horizontal', props: { relative: true, x: 10 } },\n  { type: 'close', props: null } ]\n```\n\n### Generalization\nYou can also generalize SVG paths to restrict them to `moveTo`, `lineTo`, `curveTo`, and `arc` commands, which are easier to draw:\n```js\nconst { parse } = require('svg-parse');\n\nconst path = parse('M10 20 L20 20 h10 Z', { generalize: true });\nconsole.dir(path);\n```\n\nThe result will be:\n\n```js\n[ { type: 'moveTo', props: { relative: false, x: 10, y: 20 } },\n  { type: 'lineTo', props: { relative: false, x: 20, y: 20 } },\n  // Compare with result above!\n  { type: 'lineTo', props: { relative: true, x: 10, y: 0 } },\n  { type: 'close', props: null } ]\n```\n\n## Changelog\n\nPlease take a look at changes in the [CHANGELOG.md].\n\n[CHANGELOG.md]: https://github.com/ksm2/svg-parse/blob/master/CHANGELOG.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksm2%2Fsvg-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksm2%2Fsvg-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksm2%2Fsvg-parse/lists"}