
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
svg-path-bbox
Advanced tools
SVG paths bounding box calculator.
npm install svg-path-bbox
> import { svgPathBbox } from "svg-path-bbox";
> svgPathBbox("M5 10l2 3z")
[ 5, 10, 7, 13 ]
> svgPathBbox("M5 10c3 0 3 3 0 3z")
[ 5, 10, 7.25, 13 ]
Returned bounding box is an array made up like viewBox
SVG attributes [x0, y0, x1, y1]
of unrounded values:
$ svg-path-bbox "M5 10c3 0 3 3 0 3z"
5 10 7.25 13
$ svg-path-bbox "M5 10c3 0 3 3 0 3z" "M2 8m5 5z"
5 10 7.25 13
2 8 7 13
import { svgPathBbox } from "svg-path-bbox";
import type { BBox } from "svg-path-bbox";
const cases: [string, BBox][] = [["M0 0H3V6Z", [0, 0, 3, 6]]];
console.log(svgPathBbox(cases[0]));
# svgPathBbox(d : string | typeof import('svgpath')) ⇒ [minX: number, minY: number, maxX: number, maxY: number]
Computes the bounding box of SVG path following the SVG 1.1 specification.
SvgPath
interface from svgpath.[2.1.0] - 2024-09-04
SvgPath
interface from [svgpath] as argument. This makes
svgPathBbox
x2 faster when using SvgPath
instances.FAQs
Compute bounding boxes of SVG paths.
The npm package svg-path-bbox receives a total of 10,103 weekly downloads. As such, svg-path-bbox popularity was classified as popular.
We found that svg-path-bbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.