@antv/util

  • Version 3.3.0
  • Published
  • 847 kB
  • 2 dependencies
  • MIT license

Install

npm i @antv/util
yarn add @antv/util
pnpm add @antv/util

Overview

> AntV 底层依赖的工具库,不建议在自己业务中使用。

Index

Functions

Classes

Interfaces

Type Aliases

Functions

function angleTo

angleTo: (
v1: [number, number],
v2: [number, number],
direct?: boolean
) => number;
  • 二维向量 v1 到 v2 的夹角

    Parameter v1

    Parameter v2

    Parameter direct

function assign

assign: <Base, A, B, C>(
dist: Base & A & B & C,
src1?: A,
src2?: B,
src3?: C
) => Base & A & B & C;

    function augment

    augment: (...args: any[]) => void;

      function clamp

      clamp: (a: number, min: number, max: number) => number;

        function clearAnimationFrame

        clearAnimationFrame: (handler: number) => void;

          function clone

          clone: (obj: any) => any;

            function clonePath

            clonePath: (path: PathArray | PathSegment) => PathArray;

              function contains

              contains: (arr: any[], value: any) => boolean;

                function debounce

                debounce: (func: Function, wait?: number, immediate?: boolean) => () => void;

                  function deepMix

                  deepMix: (rst: any, ...args: any[]) => any;

                    function difference

                    difference: <T>(arr: T[], values?: T[]) => T[];
                    • Flattens array a single level deep.

                      Parameter arr

                      The array to inspect.

                      Parameter values

                      The values to exclude. {Array} Returns the new array of filtered values.

                      Example 1

                      difference([2, 1], [2, 3]); // => [1]

                    function direction

                    direction: (v1: number[], v2: number[]) => number;
                    • 向量 v1 到 向量 v2 夹角的方向

                      Parameter v1

                      向量

                      Parameter v2

                      向量 {Boolean} >= 0 顺时针 < 0 逆时针

                    function distanceSquareRoot

                    distanceSquareRoot: (a: [number, number], b: [number, number]) => number;

                      function each

                      each: (elements: any[] | object, func: (v: any, k: any) => any) => void;

                        function endsWith

                        endsWith: { (arr: string, e: string): boolean; <T>(arr: T[], e: T): boolean };

                          function equalizeSegments

                          equalizeSegments: (
                          path1: PathArray,
                          path2: PathArray,
                          TL?: number
                          ) => CurveArray[];

                            function every

                            every: <T>(arr: T[], func: (v: T, idx?: number) => any) => boolean;
                            • 只要有一个不满足条件就返回 false

                              Parameter arr

                              Parameter func

                            function extend

                            extend: (
                            subclass: any,
                            superclass: any,
                            overrides?: any,
                            staticOverrides?: any
                            ) => any;

                              function filter

                              filter: <T>(arr: T[], func: (v: T, idx: number) => boolean) => T[];

                                function find

                                find: {
                                <T>(arr: T[], predicate: Function): T;
                                <T>(arr: T[], predicate: object): T;
                                };

                                  function findIndex

                                  findIndex: <T>(
                                  arr: T[],
                                  predicate: (item: T, idx?: number) => boolean,
                                  fromIndex?: number
                                  ) => number;

                                    function firstValue

                                    firstValue: (data: object[], name: string) => any;

                                      function fixedBase

                                      fixedBase: (v: number, base: number | string) => number;

                                        function flatten

                                        flatten: <T>(arr: T[]) => T[];
                                        • Flattens array a single level deep.

                                          Parameter arr

                                          The array to flatten. {Array} Returns the new flattened array.

                                          Example 1

                                          flatten([1, [2, [3, [4]], 5]]); // => [1, 2, [3, [4]], 5]

                                        function flattenDeep

                                        flattenDeep: (arr: any[], result?: any[]) => any[];
                                        • Flattens array a single level deep.

                                          Parameter arr

                                          The array to flatten.

                                          Parameter result

                                          The array to return. {Array} Returns the new flattened array.

                                          Example 1

                                          flattenDeep([1, [2, [3, [4]], 5]]); // => [1, 2, 3, 4, 5]

                                        function forIn

                                        forIn: (elements: any[] | object, func: (v: any, k: any) => any) => void;

                                          function get

                                          get: (obj: any, key: string | any[], defaultValue?: any) => any;

                                            function getDrawDirection

                                            getDrawDirection: (pathArray: PathArray) => boolean;

                                              function getPathArea

                                              getPathArea: (path: PathArray) => number;
                                              • Returns the area of a shape. Jürg Lehni & Jonathan Puckey

                                                See Also

                                                • https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js

                                              function getPathBBox

                                              getPathBBox: (
                                              path: string | PathArray,
                                              options?: Partial<PathLengthFactoryOptions>
                                              ) => PathBBox;
                                              • Returns the bounding box of a shape.

                                              function getPathBBoxTotalLength

                                              getPathBBoxTotalLength: (
                                              path: PathArray,
                                              options?: Partial<PathLengthFactoryOptions>
                                              ) => PathBBoxTotalLength;
                                              • Returns the bounding box of a shape.

                                              function getPointAtLength

                                              getPointAtLength: (
                                              pathInput: string | PathArray,
                                              distance: number,
                                              options?: Partial<PathLengthFactoryOptions>
                                              ) => import('../types').Point;
                                              • Returns [x,y] coordinates of a point at a given length of a shape.

                                              function getRange

                                              getRange: (values: number[]) => RangeType;

                                                function getRotatedCurve

                                                getRotatedCurve: (
                                                a: CurveArray,
                                                b: CurveArray
                                                ) => (string[] | import('../types').MSegment | import('../types').CSegment)[];

                                                  function getTotalLength

                                                  getTotalLength: (
                                                  pathInput: string | PathArray,
                                                  options?: Partial<PathLengthFactoryOptions>
                                                  ) => number;
                                                  • Returns the shape total length, or the equivalent to shape.getTotalLength().

                                                    The normalizePath version is lighter, faster, more efficient and more accurate with paths that are not curveArray.

                                                  function getType

                                                  getType: (value: any) => string;

                                                    function getWrapBehavior

                                                    getWrapBehavior: (obj: object, action: string) => Function;
                                                    • 获取封装的事件

                                                      Parameter obj

                                                      对象

                                                      Parameter action

                                                      事件名称 {Function} 返回事件处理函数

                                                    function gradient

                                                    gradient: (colors: string | string[]) => (percent: number) => string;
                                                    • 获取渐变函数

                                                      Parameter colors

                                                      多个颜色 颜色值

                                                    function group

                                                    group: <T>(
                                                    data: T[],
                                                    condition: string | string[] | ((v: T) => string)
                                                    ) => T[][];

                                                      function groupBy

                                                      groupBy: {
                                                      <T>(data: T[], condition: (item: T) => string): ObjectType<T>;
                                                      <T>(data: T[], condition: string): ObjectType<T>;
                                                      };

                                                        function groupToMap

                                                        groupToMap: (
                                                        data: any,
                                                        condition: string | string[] | ((row: any) => string)
                                                        ) => import('./group-by').ObjectType<any> | { 0: any };
                                                        • 将数据分组成 map

                                                          Parameter data

                                                          Parameter condition

                                                        function has

                                                        has: (obj: object, key: any) => boolean;

                                                          function hasKey

                                                          hasKey: (obj: object, key: any) => boolean;

                                                            function hasValue

                                                            hasValue: (obj: object, value: any) => boolean;
                                                              head: (o: unknown) => any;

                                                                function identity

                                                                identity: <T>(v: T) => T;

                                                                  function includes

                                                                  includes: (arr: any[], value: any) => boolean;

                                                                    function indexOf

                                                                    indexOf: <T>(arr: T[], obj: T) => number;

                                                                      function isArguments

                                                                      isArguments: (value: any) => boolean;

                                                                        function isArray

                                                                        isArray: (value: any) => value is any[];

                                                                          function isArrayLike

                                                                          isArrayLike: (value: any) => boolean;

                                                                            function isBoolean

                                                                            isBoolean: (value: any) => value is boolean;

                                                                              function isDate

                                                                              isDate: (value: any) => value is Date;

                                                                                function isDecimal

                                                                                isDecimal: (num: any) => boolean;

                                                                                  function isElement

                                                                                  isElement: (o: any) => boolean;
                                                                                  • 判断是否HTML元素 {Boolean} 是否HTML元素

                                                                                  function isEmpty

                                                                                  isEmpty: (value: any) => boolean;

                                                                                    function isEqual

                                                                                    isEqual: (value: any, other: any) => boolean;

                                                                                      function isEqualWith

                                                                                      isEqualWith: <T>(value: T, other: T, fn: (v1: T, v2: T) => boolean) => boolean;

                                                                                        function isError

                                                                                        isError: (value: any) => value is Error;

                                                                                          function isEven

                                                                                          isEven: (num: any) => boolean;

                                                                                            function isFinite

                                                                                            isFinite: (value: any) => value is number;

                                                                                              function isFunction

                                                                                              isFunction: (value: any) => value is Function;

                                                                                                function isInteger

                                                                                                isInteger: (number: unknown) => boolean;

                                                                                                  function isMatch

                                                                                                  isMatch: (obj: any, attrs: any) => boolean;

                                                                                                    function isNegative

                                                                                                    isNegative: (num: any) => boolean;

                                                                                                      function isNil

                                                                                                      isNil: (value: any) => value is null;

                                                                                                        function isNull

                                                                                                        isNull: (value: any) => value is null;

                                                                                                          function isNumber

                                                                                                          isNumber: (value: any) => value is number;

                                                                                                            function isNumberEqual

                                                                                                            isNumberEqual: (a: number, b: number, precision?: number) => boolean;

                                                                                                              function isObject

                                                                                                              isObject: <T = object>(value: any) => value is T;

                                                                                                                function isObjectLike

                                                                                                                isObjectLike: (value: any) => value is object;

                                                                                                                  function isOdd

                                                                                                                  isOdd: (num: any) => boolean;

                                                                                                                    function isPlainObject

                                                                                                                    isPlainObject: (value: any) => value is object;

                                                                                                                      function isPointInPolygon

                                                                                                                      isPointInPolygon: (points: number[][], x: number, y: number) => boolean;

                                                                                                                        function isPointInStroke

                                                                                                                        isPointInStroke: (pathInput: string | PathArray, point: Point) => boolean;
                                                                                                                        • Checks if a given point is in the stroke of a path.

                                                                                                                        function isPolygonsIntersect

                                                                                                                        isPolygonsIntersect: (points1: number[][], points2: number[][]) => boolean;
                                                                                                                        • See Also

                                                                                                                          • https://stackoverflow.com/questions/753140/how-do-i-determine-if-two-convex-polygons-intersect

                                                                                                                        function isPositive

                                                                                                                        isPositive: (num: any) => boolean;

                                                                                                                          function isPrototype

                                                                                                                          isPrototype: (value: any) => boolean;

                                                                                                                            function isRegExp

                                                                                                                            isRegExp: (str: any) => str is RegExp;

                                                                                                                              function isString

                                                                                                                              isString: (str: any) => str is string;

                                                                                                                                function isType

                                                                                                                                isType: (value: any, type: string) => boolean;

                                                                                                                                  function isUndefined

                                                                                                                                  isUndefined: (value: any) => value is undefined;

                                                                                                                                    function keys

                                                                                                                                    keys: (obj: any) => any[];

                                                                                                                                      function last

                                                                                                                                      last: (o: unknown) => any;

                                                                                                                                        function lowerCase

                                                                                                                                        lowerCase: (str: string) => string;

                                                                                                                                          function lowerFirst

                                                                                                                                          lowerFirst: (value: string) => string;

                                                                                                                                            function map

                                                                                                                                            map: <T, G>(arr: T[], func: (v: T, idx: number) => G) => G[];

                                                                                                                                              function mapValues

                                                                                                                                              mapValues: <T>(
                                                                                                                                              object: { [key: string]: T },
                                                                                                                                              func?: (value: T, key: string) => any
                                                                                                                                              ) => { [key: string]: any };

                                                                                                                                                function max

                                                                                                                                                max: (arr: number[]) => number | undefined;

                                                                                                                                                  function maxBy

                                                                                                                                                  maxBy: <T>(arr: T[], fn: string | ((v: T) => number)) => T;

                                                                                                                                                    function memoize

                                                                                                                                                    memoize: (
                                                                                                                                                    f: Function,
                                                                                                                                                    resolver?: (...args: any[]) => string
                                                                                                                                                    ) => { (...args: any[]): any; cache: Map<any, any> };

                                                                                                                                                      function min

                                                                                                                                                      min: (arr: number[]) => number | undefined;

                                                                                                                                                        function minBy

                                                                                                                                                        minBy: <T>(arr: T[], fn: string | ((v: T) => number)) => T;

                                                                                                                                                          function mix

                                                                                                                                                          mix: <Base, A, B, C>(
                                                                                                                                                          dist: Base & A & B & C,
                                                                                                                                                          src1?: A,
                                                                                                                                                          src2?: B,
                                                                                                                                                          src3?: C
                                                                                                                                                          ) => Base & A & B & C;

                                                                                                                                                            function mod

                                                                                                                                                            mod: (n: number, m: number) => number;

                                                                                                                                                              function noop

                                                                                                                                                              noop: () => void;

                                                                                                                                                                function normalizePath

                                                                                                                                                                normalizePath: (pathInput: string | PathArray) => NormalArray;
                                                                                                                                                                • Example 1

                                                                                                                                                                  const path = 'M0 0 H50'; const normalizedPath = SVGPathCommander.normalizePath(path); // result => [['M', 0, 0], ['L', 50, 0]]

                                                                                                                                                                function number2color

                                                                                                                                                                number2color: (num: number) => string;

                                                                                                                                                                  function omit

                                                                                                                                                                  omit: <T>(obj: ObjectType<T>, keys: string[]) => ObjectType<T>;

                                                                                                                                                                    function parseRadius

                                                                                                                                                                    parseRadius: { (radius: number): RadiusType; (radius: number[]): RadiusType };

                                                                                                                                                                      function path2Absolute

                                                                                                                                                                      path2Absolute: (pathInput: string | PathArray) => AbsoluteArray;

                                                                                                                                                                        function path2Curve

                                                                                                                                                                        path2Curve: (
                                                                                                                                                                        pathInput: string | PathArray,
                                                                                                                                                                        needZCommandIndexes?: boolean
                                                                                                                                                                        ) => CurveArray | [CurveArray, number[]];

                                                                                                                                                                          function path2String

                                                                                                                                                                          path2String: (path: PathArray, round?: number | 'off') => string;
                                                                                                                                                                          • Returns a valid d attribute string value created by rounding values and concatenating the pathArray segments.

                                                                                                                                                                          function pick

                                                                                                                                                                          pick: <T>(object: ObjectType<T>, keys: string[]) => ObjectType<T>;

                                                                                                                                                                            function pull

                                                                                                                                                                            pull: <T>(arr: T[], ...values: any[]) => T[];

                                                                                                                                                                              function pullAt

                                                                                                                                                                              pullAt: <T>(arr: T[], indexes: number[]) => T[];

                                                                                                                                                                                function reduce

                                                                                                                                                                                reduce: <T, G>(
                                                                                                                                                                                arr: ObjectType<T> | G[],
                                                                                                                                                                                fn: (result: T, data: G, idx: string | number) => T,
                                                                                                                                                                                init: T
                                                                                                                                                                                ) => T;

                                                                                                                                                                                  function remove

                                                                                                                                                                                  remove: <T>(
                                                                                                                                                                                  arr: T[],
                                                                                                                                                                                  predicate: (value: T, idx: number, arr?: T[]) => boolean
                                                                                                                                                                                  ) => T[];

                                                                                                                                                                                    function requestAnimationFrame

                                                                                                                                                                                    requestAnimationFrame: (fn: FrameRequestCallback) => any;

                                                                                                                                                                                      function reverseCurve

                                                                                                                                                                                      reverseCurve: (pathArray: CurveArray) => CurveArray;

                                                                                                                                                                                        function rgb2arr

                                                                                                                                                                                        rgb2arr: (str: string) => number[];
                                                                                                                                                                                        • rgb 颜色转换成数组

                                                                                                                                                                                          Parameter str

                                                                                                                                                                                          Returns

                                                                                                                                                                                        function set

                                                                                                                                                                                        set: (obj: any, path: string | any[], value: any) => any;

                                                                                                                                                                                          function size

                                                                                                                                                                                          size: (o: unknown) => number;

                                                                                                                                                                                            function some

                                                                                                                                                                                            some: <T>(arr: T[], func: (v: T, idx?: number) => any) => boolean;
                                                                                                                                                                                            • 只要有一个满足条件就返回 true

                                                                                                                                                                                              Parameter arr

                                                                                                                                                                                              Parameter func

                                                                                                                                                                                            function sortBy

                                                                                                                                                                                            sortBy: {
                                                                                                                                                                                            <T>(arr: ObjectType<T>[], key: Function): ObjectType<T>[];
                                                                                                                                                                                            <T>(arr: ObjectType<T>[], key: string): ObjectType<T>[];
                                                                                                                                                                                            <T>(arr: ObjectType<T>[], key: string[]): ObjectType<T>[];
                                                                                                                                                                                            };

                                                                                                                                                                                              function startsWith

                                                                                                                                                                                              startsWith: { (arr: string, e: string): boolean; <T>(arr: T[], e: T): boolean };

                                                                                                                                                                                                function substitute

                                                                                                                                                                                                substitute: <T>(str: string, o: ObjectType<T>) => string;

                                                                                                                                                                                                  function throttle

                                                                                                                                                                                                  throttle: (func: Function, wait: number, options: OptionsType) => Function;

                                                                                                                                                                                                    function toArray

                                                                                                                                                                                                    toArray: (value: any) => any[];

                                                                                                                                                                                                      function toCSSGradient

                                                                                                                                                                                                      toCSSGradient: (gradientColor: any) => any;

                                                                                                                                                                                                        function toDegree

                                                                                                                                                                                                        toDegree: (radian: number) => number;

                                                                                                                                                                                                          function toInteger

                                                                                                                                                                                                          toInteger: (string: string, radix?: number) => number;

                                                                                                                                                                                                            function toRadian

                                                                                                                                                                                                            toRadian: (degree: number) => number;

                                                                                                                                                                                                              function toRGB

                                                                                                                                                                                                              toRGB: (color: string) => string;
                                                                                                                                                                                                              • 将颜色转换到 rgb 的格式

                                                                                                                                                                                                                Parameter color

                                                                                                                                                                                                                颜色 将颜色转换到 '#ffffff' 的格式

                                                                                                                                                                                                              function toString

                                                                                                                                                                                                              toString: (value: any) => string;

                                                                                                                                                                                                                function transform

                                                                                                                                                                                                                transform: (m: number[], actions: any[][]) => any[];
                                                                                                                                                                                                                • 根据 actions 来做 transform

                                                                                                                                                                                                                  Parameter m

                                                                                                                                                                                                                  Parameter actions

                                                                                                                                                                                                                function union

                                                                                                                                                                                                                union: (...sources: any[]) => any[];

                                                                                                                                                                                                                  function uniq

                                                                                                                                                                                                                  uniq: (arr: any[], cache?: Map<any, any>) => any[];

                                                                                                                                                                                                                    function uniqueId

                                                                                                                                                                                                                    uniqueId: (prefix?: string) => string;

                                                                                                                                                                                                                      function upperCase

                                                                                                                                                                                                                      upperCase: (str: string) => string;

                                                                                                                                                                                                                        function upperFirst

                                                                                                                                                                                                                        upperFirst: (value: string) => string;

                                                                                                                                                                                                                          function values

                                                                                                                                                                                                                          values: (obj: any) => unknown[];

                                                                                                                                                                                                                            function valuesOfKey

                                                                                                                                                                                                                            valuesOfKey: (data: any[], name: string) => any[];

                                                                                                                                                                                                                              function vertical

                                                                                                                                                                                                                              vertical: (out: number[], v: number[], flag: boolean) => number[];
                                                                                                                                                                                                                              • 计算二维向量的垂直向量

                                                                                                                                                                                                                                Parameter out

                                                                                                                                                                                                                                Parameter v

                                                                                                                                                                                                                                Parameter flag

                                                                                                                                                                                                                              function wrapBehavior

                                                                                                                                                                                                                              wrapBehavior: (obj: object, action: string) => Function;
                                                                                                                                                                                                                              • 封装事件,便于使用上下文this,和便于解除事件时使用

                                                                                                                                                                                                                                Parameter obj

                                                                                                                                                                                                                                对象

                                                                                                                                                                                                                                Parameter action

                                                                                                                                                                                                                                事件名称 {Function} 返回事件处理函数

                                                                                                                                                                                                                              Classes

                                                                                                                                                                                                                              class Cache

                                                                                                                                                                                                                              class<T> {}
                                                                                                                                                                                                                              • k-v 存储

                                                                                                                                                                                                                              property map

                                                                                                                                                                                                                              map: { [key: string]: T };

                                                                                                                                                                                                                                method clear

                                                                                                                                                                                                                                clear: () => void;

                                                                                                                                                                                                                                  method delete

                                                                                                                                                                                                                                  delete: (key: string) => void;

                                                                                                                                                                                                                                    method get

                                                                                                                                                                                                                                    get: (key: string, def?: T) => T | undefined;

                                                                                                                                                                                                                                      method has

                                                                                                                                                                                                                                      has: (key: string) => boolean;

                                                                                                                                                                                                                                        method set

                                                                                                                                                                                                                                        set: (key: string, value: T) => void;

                                                                                                                                                                                                                                          method size

                                                                                                                                                                                                                                          size: () => number;

                                                                                                                                                                                                                                            Interfaces

                                                                                                                                                                                                                                            interface LengthFactory

                                                                                                                                                                                                                                            interface LengthFactory {}

                                                                                                                                                                                                                                              property length

                                                                                                                                                                                                                                              length: number;

                                                                                                                                                                                                                                                property max

                                                                                                                                                                                                                                                max: Point;

                                                                                                                                                                                                                                                  property min

                                                                                                                                                                                                                                                  min: Point;

                                                                                                                                                                                                                                                    property point

                                                                                                                                                                                                                                                    point: Point;

                                                                                                                                                                                                                                                      interface ParserParams

                                                                                                                                                                                                                                                      interface ParserParams {}

                                                                                                                                                                                                                                                        property qx

                                                                                                                                                                                                                                                        qx: number | null;

                                                                                                                                                                                                                                                          property qy

                                                                                                                                                                                                                                                          qy: number | null;

                                                                                                                                                                                                                                                            property x

                                                                                                                                                                                                                                                            x: number;

                                                                                                                                                                                                                                                              property x1

                                                                                                                                                                                                                                                              x1: number;

                                                                                                                                                                                                                                                                property x2

                                                                                                                                                                                                                                                                x2: number;

                                                                                                                                                                                                                                                                  property y

                                                                                                                                                                                                                                                                  y: number;

                                                                                                                                                                                                                                                                    property y1

                                                                                                                                                                                                                                                                    y1: number;

                                                                                                                                                                                                                                                                      property y2

                                                                                                                                                                                                                                                                      y2: number;

                                                                                                                                                                                                                                                                        interface PathBBox

                                                                                                                                                                                                                                                                        interface PathBBox {}

                                                                                                                                                                                                                                                                          property cx

                                                                                                                                                                                                                                                                          cx: number;

                                                                                                                                                                                                                                                                            property cy

                                                                                                                                                                                                                                                                            cy: number;

                                                                                                                                                                                                                                                                              property cz

                                                                                                                                                                                                                                                                              cz: number;

                                                                                                                                                                                                                                                                                property height

                                                                                                                                                                                                                                                                                height: number;

                                                                                                                                                                                                                                                                                  property width

                                                                                                                                                                                                                                                                                  width: number;

                                                                                                                                                                                                                                                                                    property x

                                                                                                                                                                                                                                                                                    x: number;

                                                                                                                                                                                                                                                                                      property x2

                                                                                                                                                                                                                                                                                      x2: number;

                                                                                                                                                                                                                                                                                        property y

                                                                                                                                                                                                                                                                                        y: number;

                                                                                                                                                                                                                                                                                          property y2

                                                                                                                                                                                                                                                                                          y2: number;

                                                                                                                                                                                                                                                                                            interface PathBBoxTotalLength

                                                                                                                                                                                                                                                                                            interface PathBBoxTotalLength extends PathBBox {}

                                                                                                                                                                                                                                                                                              property length

                                                                                                                                                                                                                                                                                              length: number;

                                                                                                                                                                                                                                                                                                interface PathLengthFactoryOptions

                                                                                                                                                                                                                                                                                                interface PathLengthFactoryOptions {}

                                                                                                                                                                                                                                                                                                  property bbox

                                                                                                                                                                                                                                                                                                  bbox: boolean;

                                                                                                                                                                                                                                                                                                    property length

                                                                                                                                                                                                                                                                                                    length: boolean;

                                                                                                                                                                                                                                                                                                      property sampleSize

                                                                                                                                                                                                                                                                                                      sampleSize: number;

                                                                                                                                                                                                                                                                                                        interface PointProperties

                                                                                                                                                                                                                                                                                                        interface PointProperties {}

                                                                                                                                                                                                                                                                                                          property closest

                                                                                                                                                                                                                                                                                                          closest: {
                                                                                                                                                                                                                                                                                                          x: number;
                                                                                                                                                                                                                                                                                                          y: number;
                                                                                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                                                                                            property distance

                                                                                                                                                                                                                                                                                                            distance: number;

                                                                                                                                                                                                                                                                                                              property segment

                                                                                                                                                                                                                                                                                                              segment?: SegmentProperties;

                                                                                                                                                                                                                                                                                                                interface SegmentLimits

                                                                                                                                                                                                                                                                                                                interface SegmentLimits {}

                                                                                                                                                                                                                                                                                                                  property max

                                                                                                                                                                                                                                                                                                                  max: Point;

                                                                                                                                                                                                                                                                                                                    property min

                                                                                                                                                                                                                                                                                                                    min: Point;

                                                                                                                                                                                                                                                                                                                      interface SegmentProperties

                                                                                                                                                                                                                                                                                                                      interface SegmentProperties {}

                                                                                                                                                                                                                                                                                                                        property index

                                                                                                                                                                                                                                                                                                                        index: number;
                                                                                                                                                                                                                                                                                                                        • the segment index

                                                                                                                                                                                                                                                                                                                        property length

                                                                                                                                                                                                                                                                                                                        length: number;
                                                                                                                                                                                                                                                                                                                        • the segment length

                                                                                                                                                                                                                                                                                                                        property lengthAtSegment

                                                                                                                                                                                                                                                                                                                        lengthAtSegment: number;
                                                                                                                                                                                                                                                                                                                        • the length including the segment length

                                                                                                                                                                                                                                                                                                                        property segment

                                                                                                                                                                                                                                                                                                                        segment: PathSegment;
                                                                                                                                                                                                                                                                                                                        • the segment

                                                                                                                                                                                                                                                                                                                        index signature

                                                                                                                                                                                                                                                                                                                        [key: string]: any;

                                                                                                                                                                                                                                                                                                                          Type Aliases

                                                                                                                                                                                                                                                                                                                          type AbsoluteArray

                                                                                                                                                                                                                                                                                                                          type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];

                                                                                                                                                                                                                                                                                                                            type AbsoluteCommand

                                                                                                                                                                                                                                                                                                                            type AbsoluteCommand =
                                                                                                                                                                                                                                                                                                                            | MCommand
                                                                                                                                                                                                                                                                                                                            | LCommand
                                                                                                                                                                                                                                                                                                                            | VCommand
                                                                                                                                                                                                                                                                                                                            | HCommand
                                                                                                                                                                                                                                                                                                                            | ZCommand
                                                                                                                                                                                                                                                                                                                            | CCommand
                                                                                                                                                                                                                                                                                                                            | SCommand
                                                                                                                                                                                                                                                                                                                            | QCommand
                                                                                                                                                                                                                                                                                                                            | TCommand
                                                                                                                                                                                                                                                                                                                            | ACommand;

                                                                                                                                                                                                                                                                                                                              type AbsoluteSegment

                                                                                                                                                                                                                                                                                                                              type AbsoluteSegment =
                                                                                                                                                                                                                                                                                                                              | MSegment
                                                                                                                                                                                                                                                                                                                              | LSegment
                                                                                                                                                                                                                                                                                                                              | VSegment
                                                                                                                                                                                                                                                                                                                              | HSegment
                                                                                                                                                                                                                                                                                                                              | CSegment
                                                                                                                                                                                                                                                                                                                              | SSegment
                                                                                                                                                                                                                                                                                                                              | QSegment
                                                                                                                                                                                                                                                                                                                              | TSegment
                                                                                                                                                                                                                                                                                                                              | ASegment
                                                                                                                                                                                                                                                                                                                              | ZSegment;

                                                                                                                                                                                                                                                                                                                                type aCommand

                                                                                                                                                                                                                                                                                                                                type aCommand = 'a';

                                                                                                                                                                                                                                                                                                                                  type ACommand

                                                                                                                                                                                                                                                                                                                                  type ACommand = 'A';

                                                                                                                                                                                                                                                                                                                                    type ArcSegment

                                                                                                                                                                                                                                                                                                                                    type ArcSegment = ASegment | aSegment;

                                                                                                                                                                                                                                                                                                                                      type aSegment

                                                                                                                                                                                                                                                                                                                                      type aSegment = [aCommand, number, number, number, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                        type ASegment

                                                                                                                                                                                                                                                                                                                                        type ASegment = [ACommand, number, number, number, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                          type cCommand

                                                                                                                                                                                                                                                                                                                                          type cCommand = 'c';

                                                                                                                                                                                                                                                                                                                                            type CCommand

                                                                                                                                                                                                                                                                                                                                            type CCommand = 'C';

                                                                                                                                                                                                                                                                                                                                              type CloseSegment

                                                                                                                                                                                                                                                                                                                                              type CloseSegment = ZSegment | zSegment;

                                                                                                                                                                                                                                                                                                                                                type cSegment

                                                                                                                                                                                                                                                                                                                                                type cSegment = [cCommand, number, number, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                  type CSegment

                                                                                                                                                                                                                                                                                                                                                  type CSegment = [CCommand, number, number, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                    type CubicSegment

                                                                                                                                                                                                                                                                                                                                                    type CubicSegment = CSegment | cSegment;

                                                                                                                                                                                                                                                                                                                                                      type CurveArray

                                                                                                                                                                                                                                                                                                                                                      type CurveArray = [MSegment, ...CSegment[]];

                                                                                                                                                                                                                                                                                                                                                        type hCommand

                                                                                                                                                                                                                                                                                                                                                        type hCommand = 'h';

                                                                                                                                                                                                                                                                                                                                                          type HCommand

                                                                                                                                                                                                                                                                                                                                                          type HCommand = 'H';

                                                                                                                                                                                                                                                                                                                                                            type HorLineSegment

                                                                                                                                                                                                                                                                                                                                                            type HorLineSegment = HSegment | hSegment;

                                                                                                                                                                                                                                                                                                                                                              type hSegment

                                                                                                                                                                                                                                                                                                                                                              type hSegment = [hCommand, number];

                                                                                                                                                                                                                                                                                                                                                                type HSegment

                                                                                                                                                                                                                                                                                                                                                                type HSegment = [HCommand, number];

                                                                                                                                                                                                                                                                                                                                                                  type lCommand

                                                                                                                                                                                                                                                                                                                                                                  type lCommand = 'l';

                                                                                                                                                                                                                                                                                                                                                                    type LCommand

                                                                                                                                                                                                                                                                                                                                                                    type LCommand = 'L';

                                                                                                                                                                                                                                                                                                                                                                      type LineSegment

                                                                                                                                                                                                                                                                                                                                                                      type LineSegment = LSegment | lSegment;

                                                                                                                                                                                                                                                                                                                                                                        type lSegment

                                                                                                                                                                                                                                                                                                                                                                        type lSegment = [lCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                          type LSegment

                                                                                                                                                                                                                                                                                                                                                                          type LSegment = [LCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                            type mCommand

                                                                                                                                                                                                                                                                                                                                                                            type mCommand = 'm';

                                                                                                                                                                                                                                                                                                                                                                              type MCommand

                                                                                                                                                                                                                                                                                                                                                                              type MCommand = 'M';

                                                                                                                                                                                                                                                                                                                                                                                type MoveSegment

                                                                                                                                                                                                                                                                                                                                                                                type MoveSegment = MSegment | mSegment;

                                                                                                                                                                                                                                                                                                                                                                                  type mSegment

                                                                                                                                                                                                                                                                                                                                                                                  type mSegment = [mCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                                    type MSegment

                                                                                                                                                                                                                                                                                                                                                                                    type MSegment = [MCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                                      type NormalArray

                                                                                                                                                                                                                                                                                                                                                                                      type NormalArray = [MSegment, ...NormalSegment[]];

                                                                                                                                                                                                                                                                                                                                                                                        type NormalSegment

                                                                                                                                                                                                                                                                                                                                                                                        type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;

                                                                                                                                                                                                                                                                                                                                                                                          type PathArray

                                                                                                                                                                                                                                                                                                                                                                                          type PathArray = [MSegment | mSegment, ...PathSegment[]];

                                                                                                                                                                                                                                                                                                                                                                                            type PathCommand

                                                                                                                                                                                                                                                                                                                                                                                            type PathCommand = AbsoluteCommand | RelativeCommand;

                                                                                                                                                                                                                                                                                                                                                                                              type PathSegment

                                                                                                                                                                                                                                                                                                                                                                                              type PathSegment =
                                                                                                                                                                                                                                                                                                                                                                                              | MoveSegment
                                                                                                                                                                                                                                                                                                                                                                                              | LineSegment
                                                                                                                                                                                                                                                                                                                                                                                              | VertLineSegment
                                                                                                                                                                                                                                                                                                                                                                                              | HorLineSegment
                                                                                                                                                                                                                                                                                                                                                                                              | CloseSegment
                                                                                                                                                                                                                                                                                                                                                                                              | CubicSegment
                                                                                                                                                                                                                                                                                                                                                                                              | ShortCubicSegment
                                                                                                                                                                                                                                                                                                                                                                                              | QuadSegment
                                                                                                                                                                                                                                                                                                                                                                                              | ShortQuadSegment
                                                                                                                                                                                                                                                                                                                                                                                              | ArcSegment;

                                                                                                                                                                                                                                                                                                                                                                                                type Point

                                                                                                                                                                                                                                                                                                                                                                                                type Point = {
                                                                                                                                                                                                                                                                                                                                                                                                x: number;
                                                                                                                                                                                                                                                                                                                                                                                                y: number;
                                                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                                                  type PolygonArray

                                                                                                                                                                                                                                                                                                                                                                                                  type PolygonArray = [MSegment, ...LSegment[], ZSegment];

                                                                                                                                                                                                                                                                                                                                                                                                    type PolylineArray

                                                                                                                                                                                                                                                                                                                                                                                                    type PolylineArray = [MSegment, ...LSegment[]];

                                                                                                                                                                                                                                                                                                                                                                                                      type qCommand

                                                                                                                                                                                                                                                                                                                                                                                                      type qCommand = 'q';

                                                                                                                                                                                                                                                                                                                                                                                                        type QCommand

                                                                                                                                                                                                                                                                                                                                                                                                        type QCommand = 'Q';

                                                                                                                                                                                                                                                                                                                                                                                                          type qSegment

                                                                                                                                                                                                                                                                                                                                                                                                          type qSegment = [qCommand, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                            type QSegment

                                                                                                                                                                                                                                                                                                                                                                                                            type QSegment = [QCommand, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                              type QuadSegment

                                                                                                                                                                                                                                                                                                                                                                                                              type QuadSegment = QSegment | qSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                type RelativeArray

                                                                                                                                                                                                                                                                                                                                                                                                                type RelativeArray = [MSegment, ...RelativeSegment[]];

                                                                                                                                                                                                                                                                                                                                                                                                                  type RelativeCommand

                                                                                                                                                                                                                                                                                                                                                                                                                  type RelativeCommand =
                                                                                                                                                                                                                                                                                                                                                                                                                  | mCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | lCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | vCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | hCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | zCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | cCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | sCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | qCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | tCommand
                                                                                                                                                                                                                                                                                                                                                                                                                  | aCommand;

                                                                                                                                                                                                                                                                                                                                                                                                                    type RelativeSegment

                                                                                                                                                                                                                                                                                                                                                                                                                    type RelativeSegment =
                                                                                                                                                                                                                                                                                                                                                                                                                    | mSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | lSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | vSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | hSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | cSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | sSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | qSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | tSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | aSegment
                                                                                                                                                                                                                                                                                                                                                                                                                    | zSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                      type sCommand

                                                                                                                                                                                                                                                                                                                                                                                                                      type sCommand = 's';

                                                                                                                                                                                                                                                                                                                                                                                                                        type SCommand

                                                                                                                                                                                                                                                                                                                                                                                                                        type SCommand = 'S';

                                                                                                                                                                                                                                                                                                                                                                                                                          type ShortCubicSegment

                                                                                                                                                                                                                                                                                                                                                                                                                          type ShortCubicSegment = SSegment | sSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                            type ShortQuadSegment

                                                                                                                                                                                                                                                                                                                                                                                                                            type ShortQuadSegment = TSegment | tSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                              type ShortSegment

                                                                                                                                                                                                                                                                                                                                                                                                                              type ShortSegment =
                                                                                                                                                                                                                                                                                                                                                                                                                              | VertLineSegment
                                                                                                                                                                                                                                                                                                                                                                                                                              | HorLineSegment
                                                                                                                                                                                                                                                                                                                                                                                                                              | ShortCubicSegment
                                                                                                                                                                                                                                                                                                                                                                                                                              | ShortQuadSegment
                                                                                                                                                                                                                                                                                                                                                                                                                              | CloseSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                                type sSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                type sSegment = [sCommand, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                  type SSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                  type SSegment = [SCommand, number, number, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                    type tCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                    type tCommand = 't';

                                                                                                                                                                                                                                                                                                                                                                                                                                      type TCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                      type TCommand = 'T';

                                                                                                                                                                                                                                                                                                                                                                                                                                        type tSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                        type tSegment = [tCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                          type TSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                          type TSegment = [TCommand, number, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                            type vCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                            type vCommand = 'v';

                                                                                                                                                                                                                                                                                                                                                                                                                                              type VCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                              type VCommand = 'V';

                                                                                                                                                                                                                                                                                                                                                                                                                                                type VertLineSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                                type VertLineSegment = vSegment | VSegment;

                                                                                                                                                                                                                                                                                                                                                                                                                                                  type vSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                                  type vSegment = [vCommand, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                                    type VSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                                    type VSegment = [VCommand, number];

                                                                                                                                                                                                                                                                                                                                                                                                                                                      type zCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                                      type zCommand = 'z';

                                                                                                                                                                                                                                                                                                                                                                                                                                                        type ZCommand

                                                                                                                                                                                                                                                                                                                                                                                                                                                        type ZCommand = 'Z';

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type zSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type zSegment = [zCommand];

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type ZSegment

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type ZSegment = [ZCommand];

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Package Files (131)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Dependencies (2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Dev Dependencies (22)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Peer Dependencies (1)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Badge

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@antv/util.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Markdown
                                                                                                                                                                                                                                                                                                                                                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@antv/util)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTML
                                                                                                                                                                                                                                                                                                                                                                                                                                                                <a href="https://www.jsdocs.io/package/@antv/util"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>