
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pathinator
Advanced tools
SVG path builder and minifier
npm install pathinator
integerobjectobjectobjectobjectobjectobjectobjectobjectobjectPromise.<string>Parse, build, and optimize SVG path data.
| Param | Type | Description |
|---|---|---|
| [path] | string | Optional path data to parse. |
Example
import { Path } from 'pathinator';
const path = new Path()
.move(50, 100)
.line(100, 100)
.line(200, 200)
.close();
integerThe total number of commands in this path.
object 🔗 ChainableImport a path string.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| path | string | A valid path data string or polygon string. |
object 🔗 ChainableAdd a move command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | x and y coordinates. |
object 🔗 ChainableAdd a line command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | x and y coordinates. |
object 🔗 ChainableAdd a quadratic bezier curve command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | Series of coordinates. |
object 🔗 ChainableAdd a quadratic bezier curve command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | Series of coordinates. |
object 🔗 ChainableAdd an arc command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | Series of coordinates / values. |
object 🔗 ChainableAdd a close command.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| ...args | number | Move to coordinates. |
object 🔗 ChainableUpdate command values at a specific index.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| index | integer | Index of the command to update. |
| values | string, Array.<number> | New values for the command at this index. |
object 🔗 ChainableCalls callback for each point in the path.
Returns: object - this
| Param | Type | Description |
|---|---|---|
| callback | function | Provides three arguments: the Point, a boolean indicating if the point is a control point, and the command index. |
Promise.<string>Export a string of the path.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | object | Optional settings object. | |
| [settings.coordinates] | string | "initial" | 'absolute' to convert all coordinates to absolute, 'relative' to convert all coordinates to relative, 'auto' to convert coordinates to whichever is the fewest characters, 'initial' (default) to retain the coordinates set on each command |
| [settings.compress] | boolean | Remove excess whitespace and unnecessary characters. | |
| [settings.combine] | boolean | true | Combine consecutive commands that are redundant. |
| [settings.fractionDigits] | integer | 3 | Round all numbers in path to a specified number of fraction digits. |
| [settings.scale] | number, Point | Scale the entire path. If a number is provided then x and y are scaled the same. To scale x and y differently provide a Point | |
| [settings.translate] | number, Point | Translate the entire string a specified distance. If a number is provided then x and y are translated the same. To translated x and y differently provide a Point | |
| [settings.maxCharsPerLine] | number, Point | Add newlines at logical breaks in the path to improve readability. | |
| [settings.commandsOnNewLines] | number, Point | Add a newline between each command. | |
| [settings.toPolygon] | boolean | Format the string for use in a polygon element. Sets coordinates to 'absolute'. | |
| [settings.async] | boolean | false | Process each command in a separate Promise. |
FAQs
SVG path builder and minifier
The npm package pathinator receives a total of 19 weekly downloads. As such, pathinator popularity was classified as not popular.
We found that pathinator 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.