@antv/util

  • Version 3.3.11
  • Published
  • 911 kB
  • 3 dependencies
  • MIT license

Install

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

Overview

<h1 align="center">@antv/util</h1>

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable toRGB

const toRGB: (color: string) => string;
  • export with memoize.

    Parameter color

    Returns

Functions

function angleTo

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

    Parameter v1

    Parameter v2

    Parameter direct

function arcToCubic

arcToCubic: (
X1: number,
Y1: number,
RX: number,
RY: number,
angle: number,
LAF: number,
SF: number,
X2: number,
Y2: number,
recursive: number[]
) => any[];
  • Converts A (arc-to) segments to C (cubic-bezier-to).

    For more information of where this math came from visit: http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes

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 createDOM

                createDOM: (str: string) => HTMLElement;
                • Create DOM from a html string.

                  Parameter str

                  Returns

                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,
                          depth?: 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;
                                          • https://github.com/developit/dlv/blob/master/index.js

                                            Parameter obj

                                            Parameter key

                                            Parameter defaultValue

                                          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: unknown) => value is any[];
                                                                      • 判断值是否为数组 是否为数组

                                                                      function isArrayLike

                                                                      isArrayLike: (value: any) => boolean;

                                                                        function isBoolean

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

                                                                          function isDate

                                                                          isDate: (value: unknown) => value is Date;
                                                                          • 判断值是否为 Date 是否为 Date

                                                                          function isDecimal

                                                                          isDecimal: (num: unknown) => boolean;
                                                                          • 判断值是否为小数 是否为小数

                                                                          function isElement

                                                                          isElement: (value: unknown) => value is Element | Document;
                                                                          • 判断值是否为 HTML Element 或 Document 是否为 HTML Element 或 Document

                                                                          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;
                                                                              • Parameter value

                                                                                The value to compare.

                                                                                Parameter other

                                                                                The other value to compare.

                                                                                Parameter fn

                                                                                The function to customize comparisons.

                                                                                Returns

                                                                                {boolean} Returns true if the values are equivalent, else false.

                                                                                Example 1

                                                                                function isGreeting(value) { return /^h(?:i|ello)$/.test(value); }

                                                                                function customizer(objValue, othValue) { if (isGreeting(objValue) && isGreeting(othValue)) { return true; } }

                                                                                var array = ['hello', 'goodbye']; var other = ['hi', 'goodbye'];

                                                                                isEqualWith(array, other, customizer); // => true

                                                                              function isError

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

                                                                                function isEven

                                                                                isEven: (num: number) => boolean;
                                                                                • 判断值是否为偶数 是否为偶数

                                                                                function isFinite

                                                                                isFinite: (value: number) => boolean;
                                                                                • 判断值是否为有限数 是否为有限数

                                                                                function isFunction

                                                                                isFunction: (value: unknown) => value is Function;
                                                                                • 判断值是否为函数 是否为函数

                                                                                function isInteger

                                                                                isInteger: (value: number) => boolean;
                                                                                • 判断值是否为整数 是否为整数

                                                                                function isMatch

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

                                                                                  function isNegative

                                                                                  isNegative: (num: number) => boolean;
                                                                                  • 判断值是否为负数 是否为负数

                                                                                  function isNil

                                                                                  isNil: (value: unknown) => value is null;
                                                                                  • 判断值是否为 null 或 undefined 是否为 null 或 undefined

                                                                                  function isNull

                                                                                  isNull: (value: unknown) => value is null;
                                                                                  • 判断值是否为 null 是否为 null

                                                                                  function isNumber

                                                                                  isNumber: (value: unknown) => 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: number) => 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: (value: unknown) => value 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;
                                                                                                                • 计算数组的最大值

                                                                                                                  Parameter arr

                                                                                                                  数组 最大值

                                                                                                                function maxBy

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

                                                                                                                  The array to iterate over.

                                                                                                                  Parameter fn

                                                                                                                  The iteratee invoked per element. {*} Returns the maximum value.

                                                                                                                  Example 1

                                                                                                                  var objects = [{ 'n': 1 }, { 'n': 2 }];

                                                                                                                  maxBy(objects, function(o) { return o.n; }); // => { 'n': 2 }

                                                                                                                  maxBy(objects, 'n'); // => { 'n': 2 }

                                                                                                                function memoize

                                                                                                                memoize: <T extends Function>(
                                                                                                                fn: T,
                                                                                                                resolver?: (...args: any[]) => string,
                                                                                                                maxSize?: number
                                                                                                                ) => T;
                                                                                                                • 缓存函数的计算结果,避免重复计算

                                                                                                                  Parameter fn

                                                                                                                  缓存的函数

                                                                                                                  Parameter resolver

                                                                                                                  生成缓存 key 的函数

                                                                                                                  Parameter maxSize

                                                                                                                  lru 缓存的大小

                                                                                                                  Example 1

                                                                                                                  _.memoize(calColor); _.memoize(calColor, (...args) => args[0]);

                                                                                                                function min

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

                                                                                                                  The array to iterate over. {*} Returns the minimum value.

                                                                                                                  Example 1

                                                                                                                  min([1, 2]); // => 1

                                                                                                                  min([]); // => undefined

                                                                                                                  const data = new Array(1250010).fill(1).map((d,idx) => idx);

                                                                                                                  min(data); // => 1250010 // Math.min(...data) will encounter "Maximum call stack size exceeded" error

                                                                                                                function minBy

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

                                                                                                                  The array to iterate over.

                                                                                                                  Parameter fn

                                                                                                                  The iteratee invoked per element. {*} Returns the minimum value.

                                                                                                                  Example 1

                                                                                                                  var objects = [{ 'n': 1 }, { 'n': 2 }];

                                                                                                                  minBy(objects, function(o) { return o.n; }); // => { 'n': 1 }

                                                                                                                  minBy(objects, 'n'); // => { 'n': 1 }

                                                                                                                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 modifyCSS

                                                                                                                    modifyCSS: (
                                                                                                                    dom: HTMLElement | null | undefined,
                                                                                                                    css: { [key: string]: any }
                                                                                                                    ) => HTMLElement;
                                                                                                                    • Modify the CSS of a DOM.

                                                                                                                      Parameter dom

                                                                                                                      Parameter css

                                                                                                                      Returns

                                                                                                                    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;
                                                                                                                            • Converts a PathArray to an AbsoluteArray.

                                                                                                                            function path2Array

                                                                                                                            path2Array: (pathInput: string) => PathArray;

                                                                                                                              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: G[] | ObjectType<T>,
                                                                                                                                      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;
                                                                                                                                              • https://github.com/developit/dlv/blob/master/index.js

                                                                                                                                                Parameter obj

                                                                                                                                                Parameter path

                                                                                                                                                Parameter value

                                                                                                                                              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;
                                                                                                                                                          • 将 g 渐变转换为 css 渐变

                                                                                                                                                          function toDegree

                                                                                                                                                          toDegree: (radian: number) => number;

                                                                                                                                                            function toInteger

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

                                                                                                                                                              function toRadian

                                                                                                                                                              toRadian: (degree: number) => number;

                                                                                                                                                                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) => any[];

                                                                                                                                                                              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 (138)

                                                                                                                                                                                                                                                                                                                                                                                                                Dependencies (3)

                                                                                                                                                                                                                                                                                                                                                                                                                Dev Dependencies (26)

                                                                                                                                                                                                                                                                                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                                No peer dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                                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>