Socket
Socket
Sign inDemoInstall

@antv/path-util

Package Overview
Dependencies
Maintainers
53
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/path-util

A common util collection for antv projects


Version published
Maintainers
53
Created

What is @antv/path-util?

@antv/path-util is a utility library for manipulating and analyzing SVG paths. It provides functions for parsing, transforming, and generating SVG path data, which is useful for various graphical and data visualization tasks.

What are @antv/path-util's main functionalities?

Parsing SVG Path Data

This feature allows you to parse an SVG path string into an array of path commands, making it easier to manipulate and analyze the path data.

const { parsePathString } = require('@antv/path-util');
const pathString = 'M10 10 H 90 V 90 H 10 Z';
const parsedPath = parsePathString(pathString);
console.log(parsedPath);

Transforming Path Data

This feature allows you to apply transformations like scaling, rotating, and translating to an SVG path string.

const { transformPath } = require('@antv/path-util');
const pathString = 'M10 10 H 90 V 90 H 10 Z';
const transform = 'scale(2)';
const transformedPath = transformPath(pathString, transform);
console.log(transformedPath);

Generating SVG Path Data

This feature allows you to convert an array of path commands back into an SVG path string, which can be used in SVG elements.

const { pathToString } = require('@antv/path-util');
const pathArray = [['M', 10, 10], ['H', 90], ['V', 90], ['H', 10], ['Z']];
const pathString = pathToString(pathArray);
console.log(pathString);

Other packages similar to @antv/path-util

Keywords

FAQs

Package last updated on 06 Oct 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc