Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
svg-path-generator
Advanced tools
Readme
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 1,287 weekly downloads. As such, svg-path-generator popularity was classified as 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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.