@antv/util
Version:
> AntV 底层依赖的工具库,不建议在自己业务中使用。
14 lines (12 loc) • 476 B
text/typescript
import type { PathArray } from '../types';
import { isNormalizedArray } from './is-normalized-array';
/**
* Iterates an array to check if it's a `PathArray`
* with all C (cubic bezier) segments.
*
* @param {string | PathArray} path the `Array` to be checked
* @returns {boolean} iteration result
*/
export function isCurveArray(path: string | PathArray): path is PathArray {
return isNormalizedArray(path) && (path as PathArray).every(([pc]) => 'MC'.includes(pc));
}