{"id":15374770,"url":"https://github.com/mondeja/svg-path-bbox","last_synced_at":"2025-04-05T00:05:43.489Z","repository":{"id":39752452,"uuid":"264276059","full_name":"mondeja/svg-path-bbox","owner":"mondeja","description":"SVG paths bounding box calculator","archived":false,"fork":false,"pushed_at":"2025-03-03T17:00:44.000Z","size":1147,"stargazers_count":53,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T14:17:27.958Z","etag":null,"topics":["bbox","path","svg"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/svg-path-bbox","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mondeja.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-15T19:03:11.000Z","updated_at":"2025-03-03T17:00:47.000Z","dependencies_parsed_at":"2023-02-08T07:00:23.022Z","dependency_job_id":"5e69c02e-5409-4bc0-b66f-80e4224a80dd","html_url":"https://github.com/mondeja/svg-path-bbox","commit_stats":{"total_commits":203,"total_committers":7,"mean_commits":29.0,"dds":0.3990147783251231,"last_synced_commit":"489af87c66f8dd9a37050bdb345f92ccd47807a5"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-bbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-bbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-bbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mondeja%2Fsvg-path-bbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mondeja","download_url":"https://codeload.github.com/mondeja/svg-path-bbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604612,"owners_count":20804100,"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":["bbox","path","svg"],"created_at":"2024-10-01T13:59:43.667Z","updated_at":"2025-04-05T00:05:43.470Z","avatar_url":"https://github.com/mondeja.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📦 svg-path-bbox\n\n[![NPM version][npm-version-image]][npm-link]\n[![License][license-image]][license-link]\n[![NodeJS versions][npm-versions-image]][npm-link]\n\nSVG paths bounding box calculator.\n\n## Status\n\n[![Tests][tests-image]][tests-link]\n[![Coverage status][coveralls-image]][coveralls-link]\n\n## Install\n\n```sh\nnpm install svg-path-bbox\n```\n\n## Documentation\n\n### Usage\n\n```javascript\n\u003e import { svgPathBbox } from \"svg-path-bbox\";\n\u003e svgPathBbox(\"M5 10l2 3z\")\n[ 5, 10, 7, 13 ]\n\u003e svgPathBbox(\"M5 10c3 0 3 3 0 3z\")\n[ 5, 10, 7.25, 13 ]\n```\n\nReturned bounding box is an array made up like `viewBox` SVG attributes `[x0, y0, x1, y1]` of unrounded values:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"256\" height=\"256\" src=\"https://raw.githubusercontent.com/mondeja/svg-path-bbox/master/svg-path-bbox.svg\"\u003e\n\u003c/p\u003e\n\n### Command line\n\n```bash\n$ svg-path-bbox \"M5 10c3 0 3 3 0 3z\"\n5 10 7.25 13\n\n$ svg-path-bbox \"M5 10c3 0 3 3 0 3z\" \"M2 8m5 5z\"\n5 10 7.25 13\n2 8 7 13\n```\n\n### Typescript usage\n\n```typescript\nimport { svgPathBbox } from \"svg-path-bbox\";\nimport type { BBox } from \"svg-path-bbox\";\n\nconst cases: [string, BBox][] = [[\"M0 0H3V6Z\", [0, 0, 3, 6]]];\nconsole.log(svgPathBbox(cases[0]));\n```\n\n### Reference\n\n\u003ca name=\"svgPathBbox\" href=\"#svgPathBbox\"\u003e#\u003c/a\u003e **svgPathBbox**(d : _string_ | typeof import('svgpath')) ⇒ [minX: _number_, minY: _number_, maxX: _number_, maxY: _number_]\n\nComputes the bounding box of SVG path following the [SVG 1.1 specification](https://www.w3.org/TR/SVG/paths.html).\n\n- **d** (_string_ | typeof import('svgpath')) SVG path. Can be a string or a `SvgPath` interface from [svgpath].\n\n## Thanks to\n\n- [simple-icons/simple-icons](https://github.com/simple-icons/simple-icons) for reference dataset.\n- [kpym/SVGPathy](https://github.com/kpym/SVGPathy) for reference implementation.\n- [icons8/svg-path-bounding-box](https://github.com/icons8/svg-path-bounding-box) because [their bug](https://github.com/icons8/svg-path-bounding-box/issues/3) has been the source of this library.\n- [mathandy/svgpathtools](https://github.com/mathandy/svgpathtools/) for reference implementation to compare with.\n- [svgpath](https://www.npmjs.com/package/svgpath) as is used internally by svg-path-bbox to parse and transform paths before compute bounding boxes.\n\n[npm-link]: https://www.npmjs.com/package/svg-path-bbox\n[npm-version-image]: https://img.shields.io/npm/v/svg-path-bbox\n[tests-image]: https://img.shields.io/github/actions/workflow/status/mondeja/svg-path-bbox/ci.yml?branch=master\u0026logo=github\u0026label=tests\n[tests-link]: https://github.com/mondeja/svg-path-bbox/actions?query=workflow%3ATest\n[coveralls-image]: https://coveralls.io/repos/github/mondeja/svg-path-bbox/badge.svg?branch=master\n[coveralls-link]: https://coveralls.io/github/mondeja/svg-path-bbox?branch=master\n[license-image]: https://img.shields.io/npm/l/svg-path-bbox?color=brightgreen\n[license-link]: https://github.com/mondeja/svg-path-bbox/blob/master/LICENSE\n[npm-versions-image]: https://img.shields.io/node/v/svg-path-bbox\n[svgpath]: https://www.npmjs.com/package/svgpath\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fsvg-path-bbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmondeja%2Fsvg-path-bbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmondeja%2Fsvg-path-bbox/lists"}