New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pathinator

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pathinator

SVG path builder and minifier

Source
npmnpm
Version
0.2.2
Version published
Weekly downloads
29
-23.68%
Maintainers
1
Weekly downloads
 
Created
Source

Pathinator

SVG path builder and minifier

npm build coverage deps size vulnerabilities license


Installation

npm install pathinator


Path


new Path([path])

Parse, build, and optimize SVG path data.

ParamTypeDescription
[path]stringOptional path data to parse.

Example

import { Path } from 'pathinator';

const path = new Path()
    .move(50, 100)
    .line(100, 100)
    .line(200, 200)
    .close();


path.length ⇒ integer

The total number of commands in this path.


path.import(path) ⇒ object     🔗 Chainable

Import a path string.

Returns: object - this

ParamTypeDescription
pathstringA valid path data string or polygon string.


path.move(...args) ⇒ object     🔗 Chainable

Add a move command.

Returns: object - this

ParamTypeDescription
...argsnumberx and y coordinates.


path.line(...args) ⇒ object     🔗 Chainable

Add a line command.

Returns: object - this

ParamTypeDescription
...argsnumberx and y coordinates.


path.cubic(...args) ⇒ object     🔗 Chainable

Add a quadratic bezier curve command.

Returns: object - this

ParamTypeDescription
...argsnumberSeries of coordinates.


path.quadratic(...args) ⇒ object     🔗 Chainable

Add a quadratic bezier curve command.

Returns: object - this

ParamTypeDescription
...argsnumberSeries of coordinates.


path.arc(...args) ⇒ object     🔗 Chainable

Add an arc command.

Returns: object - this

ParamTypeDescription
...argsnumberSeries of coordinates / values.


path.close(...args) ⇒ object     🔗 Chainable

Add a close command.

Returns: object - this

ParamTypeDescription
...argsnumberMove to coordinates.


path.update(index, values) ⇒ object     🔗 Chainable

Update command values at a specific index.

Returns: object - this

ParamTypeDescription
indexintegerIndex of the command to update.
valuesstring, Array.<number>New values for the command at this index.


path.eachPoint(callback) ⇒ object     🔗 Chainable

Calls callback for each point in the path.

Returns: object - this

ParamTypeDescription
callbackfunctionProvides three arguments: the Point, a boolean indicating if the point is a control point, and the command index.


path.export([settings]) ⇒ Promise.<string>

Export a string of the path.

ParamTypeDefaultDescription
[settings]objectOptional 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]booleanRemove excess whitespace and unnecessary characters.
[settings.combine]booleantrueCombine consecutive commands that are redundant.
[settings.fractionDigits]integer3Round all numbers in path to a specified number of fraction digits.
[settings.scale]number, PointScale 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, PointTranslate 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, PointAdd newlines at logical breaks in the path to improve readability.
[settings.commandsOnNewLines]number, PointAdd a newline between each command.
[settings.toPolygon]booleanFormat the string for use in a polygon element. Sets coordinates to 'absolute'.
[settings.async]booleanfalseProcess each command in a separate Promise.

Keywords

svg

FAQs

Package last updated on 03 Apr 2020

Did you know?

Socket

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.

Install

Related posts