Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@antv/path-util
Advanced tools
@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.
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);
svg-path-parser is a library for parsing and transforming SVG path data. It provides similar functionality to @antv/path-util, including parsing path strings into command arrays and applying transformations. However, it may not have as extensive a set of utilities as @antv/path-util.
svg-pathdata is another library for working with SVG path data. It offers parsing, transforming, and generating path data, similar to @antv/path-util. It also includes additional features like path normalization and simplification, which can be useful for more advanced path manipulations.
path-data-polyfill is a polyfill for the SVGPathElement API, providing methods for parsing, transforming, and generating SVG path data. It aims to bring modern SVG path manipulation capabilities to older browsers, making it a good choice for projects that need to support a wide range of environments.
为
antv
开发的轻量级 path 处理的工具库。
tnpm i --save @antv/util
// 所有的 api 是都这么引入,名字不同而已
import { parsePathString, path2Curve } from '@antv/path-util';
String
: 将数组转成字符串String[]
: 将字符串转换成数组String[]
: 转曲String[]
: 都转换成大写绝对路径的写法String[]
: 支持圆角的矩形TODO 完善上述各个方法的使用实例。
FAQs
A common util collection for antv projects
We found that @antv/path-util demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 58 open source maintainers 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.