@antv/util
Version:
> AntV 底层依赖的工具库,不建议在自己业务中使用。
13 lines (11 loc) • 403 B
text/typescript
import { roundPath } from '../process/round-path';
import type { PathArray } from '../types';
/**
* Returns a valid `d` attribute string value created
* by rounding values and concatenating the `pathArray` segments.
*/
export function path2String(path: PathArray, round: number | 'off' = 'off'): string {
return roundPath(path, round)
.map((x) => x[0] + x.slice(1).join(' '))
.join('');
}