
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
svg-path-generator
Advanced tools
use with node or in browser with browserify
npm install svg-path-generator
var Path = require('svg-path-generator');
var path = Path()
.moveTo(10, 25)
.lineTo(10, 75)
.lineTo(60, 75)
.lineTo(10, 25)
.end();
console.log(path) // M 10 25 L 10 75 L 60 75 L 10 25
to use relative coordinates, call .relative()
before any method
e.g.
var Path = require('svg-path-generator');
var path = Path()
.moveTo(10, 25)
.relative().lineTo(0, 50)
.relative().lineTo(50, 0)
.relative().lineTo(-50, -50)
.end();
console.log(path) // M 10 25 l 0 50 l 50 0 l -50 -50
both paths are equivalent.
moveTo(x, y)
Path.moveTo(x1, y1, x2, y2)
is equivalent to Path.moveTo(x1, y1).moveTo(x2, y2)
lineTo(x, y)
horizontalLineTo(x)
verticalLineTo(y)
curveTo(x1, y1, x2, y2, x, y)
smoothCurveTo(x2, y2, x, y)
bezierCurveTo(x1, y1, x, y)
smoothBezierCurveTo(x, y)
ellipticalArc(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y)
close()
.relative()
call before any method to have the method accept relative instead of absolute coordinates.end()
converts the Path object to a string. This also gets called on the .toString()
methodMIT
FAQs
Easily generate svg path strings
The npm package svg-path-generator receives a total of 773 weekly downloads. As such, svg-path-generator popularity was classified as not popular.
We found that svg-path-generator demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.