@math.gl/types 4.0.0 → 4.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,62 @@
1
1
  /**
2
2
  * TypeScript type covering all typed arrays
3
3
  */
4
- export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
5
- export declare type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
4
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
5
+ export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
6
6
  /**
7
7
  * TypeScript type covering all typed arrays and classic arrays consisting of numbers
8
8
  */
9
- export declare type NumericArray = TypedArray | number[];
9
+ export type NumericArray = TypedArray | number[];
10
10
  /**
11
11
  * TypeScript type covering all typed arrays and classic arrays consisting of numbers
12
12
  * @note alias for NumericArray
13
13
  */
14
- export declare type NumberArray = NumericArray;
15
- //# sourceMappingURL=array-types.d.ts.map
14
+ export type NumberArray = TypedArray | number[];
15
+ /** Array with exactly 1 number */
16
+ export type NumberArray1 = [number];
17
+ /** Array with exactly 2 numbers */
18
+ export type NumberArray2 = [number, number];
19
+ /** Array with exactly 3 numbers */
20
+ export type NumberArray3 = [number, number, number];
21
+ /** Array with exactly 4 numbers */
22
+ export type NumberArray4 = [number, number, number, number];
23
+ /** Array with exactly 6 numbers */
24
+ export type NumberArray6 = [number, number, number, number, number, number];
25
+ /** Array with exactly 8 numbers */
26
+ export type NumberArray8 = [number, number, number, number, number, number, number, number];
27
+ /** Array with exactly 9 numbers */
28
+ export type NumberArray9 = [number, number, number, number, number, number, number, number, number];
29
+ /** Array with exactly 12 numbers */
30
+ export type NumberArray12 = [
31
+ number,
32
+ number,
33
+ number,
34
+ number,
35
+ number,
36
+ number,
37
+ number,
38
+ number,
39
+ number,
40
+ number,
41
+ number,
42
+ number
43
+ ];
44
+ /** Array with exactly 16 numbers */
45
+ export type NumberArray16 = [
46
+ number,
47
+ number,
48
+ number,
49
+ number,
50
+ number,
51
+ number,
52
+ number,
53
+ number,
54
+ number,
55
+ number,
56
+ number,
57
+ number,
58
+ number,
59
+ number,
60
+ number,
61
+ number
62
+ ];
@@ -1,2 +1,4 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  export {};
2
- //# sourceMappingURL=array-types.js.map
package/dist/bigint.d.ts CHANGED
@@ -18,4 +18,3 @@ declare const BigUint64ArrayCtor: BigUint64ArrayConstructor[] | (typeof BigInt64
18
18
  export { BigIntCtor as BigInt };
19
19
  export { BigInt64ArrayCtor as BigInt64Array };
20
20
  export { BigUint64ArrayCtor as BigUint64Array };
21
- //# sourceMappingURL=bigint.d.ts.map
package/dist/bigint.js CHANGED
@@ -1,53 +1,47 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ // BigInt compatibility layer
5
+ // Inspired by ArrowJS (under Apache2 license)
6
+ // https://github.com/apache/arrow/blob/master/js/src/util/compat.ts
7
+ // Requires tsconfig.json: target=esnext or (lib: esnext.bigint)
8
+ // Requires eslint: env: {es2020: true}
1
9
  const ERR_BIGINT_UNAVAILABLE = 'BigInt is not available in this environment';
2
-
3
10
  function BigIntUnavailable() {
4
- throw new Error(ERR_BIGINT_UNAVAILABLE);
11
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
5
12
  }
6
-
7
13
  BigIntUnavailable.asIntN = () => {
8
- throw new Error(ERR_BIGINT_UNAVAILABLE);
14
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
9
15
  };
10
-
11
16
  BigIntUnavailable.asUintN = () => {
12
- throw new Error(ERR_BIGINT_UNAVAILABLE);
17
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
13
18
  };
14
-
15
19
  class BigInt64ArrayUnavailable {
16
- static get BYTES_PER_ELEMENT() {
17
- return 8;
18
- }
19
-
20
- static of() {
21
- throw new Error(ERR_BIGINT_UNAVAILABLE);
22
- }
23
-
24
- static from() {
25
- throw new Error(ERR_BIGINT_UNAVAILABLE);
26
- }
27
-
28
- constructor() {
29
- throw new Error(ERR_BIGINT_UNAVAILABLE);
30
- }
31
-
20
+ static get BYTES_PER_ELEMENT() {
21
+ return 8;
22
+ }
23
+ static of() {
24
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
25
+ }
26
+ static from() {
27
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
28
+ }
29
+ constructor() {
30
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
31
+ }
32
32
  }
33
-
34
33
  export const BigIntAvailable = typeof BigInt !== 'undefined';
35
34
  export const BigInt64ArrayAvailable = typeof BigInt64Array !== 'undefined';
36
35
  export const BigUint64ArrayAvailable = typeof BigUint64Array !== 'undefined';
37
-
38
36
  const BigIntCtor = (() => {
39
- return BigIntAvailable ? BigInt : BigIntUnavailable;
37
+ return BigIntAvailable ? BigInt : BigIntUnavailable;
40
38
  })();
41
-
42
39
  const BigInt64ArrayCtor = (() => {
43
- return BigInt64ArrayAvailable ? BigInt64Array : BigInt64ArrayUnavailable;
40
+ return BigInt64ArrayAvailable ? BigInt64Array : BigInt64ArrayUnavailable;
44
41
  })();
45
-
46
42
  const BigUint64ArrayCtor = (() => {
47
- return BigUint64ArrayAvailable ? [BigUint64Array] : [BigInt64ArrayUnavailable];
43
+ return BigUint64ArrayAvailable ? [BigUint64Array] : [BigInt64ArrayUnavailable];
48
44
  })();
49
-
50
45
  export { BigIntCtor as BigInt };
51
46
  export { BigInt64ArrayCtor as BigInt64Array };
52
47
  export { BigUint64ArrayCtor as BigUint64Array };
53
- //# sourceMappingURL=bigint.js.map
@@ -0,0 +1,10 @@
1
+ /** 2 dimensional bounds [[minX, minY], [maxX, maxY]] */
2
+ export type Bounds2D = [[number, number], [number, number]];
3
+ /** 3 dimensional bounds [[minX, minY, minZ], [maxX, maxY, maxZ]] */
4
+ export type Bounds3D = [[number, number, number], [number, number, number]];
5
+ /** 2 or 3 dimensional bounds [[minX, minY], [maxX, maxY]] or [[minX, minY, minZ], [maxX, maxY, maxZ]] */
6
+ export type Bounds = [[number, number], [number, number]] | [[number, number, number], [number, number, number]];
7
+ /** Checks if a `Bounds` is a `Bounds2D` */
8
+ export declare function isBounds2D(bounds: Bounds): bounds is Bounds2D;
9
+ /** Accepts 2D and 3D bounds and returns a 2D bound, truncating 3D dimension if necessary */
10
+ export declare function getBounds2D(bounds: Bounds): Bounds2D;
@@ -0,0 +1,16 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /** Checks if a `Bounds` is a `Bounds2D` */
5
+ export function isBounds2D(bounds) {
6
+ return bounds.length === 2;
7
+ }
8
+ /** Accepts 2D and 3D bounds and returns a 2D bound, truncating 3D dimension if necessary */
9
+ export function getBounds2D(bounds) {
10
+ return isBounds2D(bounds)
11
+ ? bounds
12
+ : [
13
+ [bounds[0][0], bounds[0][1]],
14
+ [bounds[1][0], bounds[1][1]]
15
+ ];
16
+ }
package/dist/index.cjs CHANGED
@@ -16,21 +16,22 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // src/index.ts
20
- var src_exports = {};
21
- __export(src_exports, {
19
+ // dist/index.js
20
+ var dist_exports = {};
21
+ __export(dist_exports, {
22
22
  isNumericArray: () => isNumericArray,
23
23
  isTypedArray: () => isTypedArray
24
24
  });
25
- module.exports = __toCommonJS(src_exports);
25
+ module.exports = __toCommonJS(dist_exports);
26
26
 
27
- // src/is-array.ts
27
+ // dist/is-array.js
28
28
  function isTypedArray(value) {
29
- return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
29
+ return ArrayBuffer.isView(value) && !(value instanceof DataView);
30
30
  }
31
31
  function isNumericArray(value) {
32
32
  if (Array.isArray(value)) {
33
- return value.length === 0 || typeof value[0] === "number" ? value : null;
33
+ return value.length === 0 || typeof value[0] === "number";
34
34
  }
35
35
  return isTypedArray(value);
36
36
  }
37
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["index.js", "is-array.js"],
4
+ "sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { isTypedArray, isNumericArray } from \"./is-array.js\";\n", "// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input as TypedArray, or null\n */\nexport function isTypedArray(value) {\n return ArrayBuffer.isView(value) && !(value instanceof DataView);\n}\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input as NumericArray, or null\n */\nexport function isNumericArray(value) {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number';\n }\n return isTypedArray(value);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,SAAS,aAAa,OAAO;AAChC,SAAO,YAAY,OAAO,KAAK,KAAK,EAAE,iBAAiB;AAC3D;AAMO,SAAS,eAAe,OAAO;AAClC,MAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,WAAO,MAAM,WAAW,KAAK,OAAO,MAAM,OAAO;AAAA,EACrD;AACA,SAAO,aAAa,KAAK;AAC7B;",
6
+ "names": []
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type { TypedArray, TypedArrayConstructor, NumericArray, NumberArray } from './array-types';
2
- export { isTypedArray, isNumericArray } from './is-array';
3
- //# sourceMappingURL=index.d.ts.map
1
+ export type { TypedArray, TypedArrayConstructor, NumericArray, NumberArray, NumberArray1, NumberArray2, NumberArray3, NumberArray4, NumberArray6, NumberArray8, NumberArray9, NumberArray12, NumberArray16 } from "./array-types.js";
2
+ export { isTypedArray, isNumericArray } from "./is-array.js";
3
+ export type { Bounds, Bounds2D, Bounds3D } from "./bounds-types.js";
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  export { isTypedArray, isNumericArray } from "./is-array.js";
2
- //# sourceMappingURL=index.js.map
@@ -1,14 +1,13 @@
1
- import { TypedArray, NumericArray } from './array-types';
1
+ import { TypedArray, NumericArray } from "./array-types.js";
2
2
  /**
3
3
  * Check is an array is a typed array
4
4
  * @param value value to be tested
5
5
  * @returns input as TypedArray, or null
6
6
  */
7
- export declare function isTypedArray(value: unknown): TypedArray | null;
7
+ export declare function isTypedArray(value: unknown): value is TypedArray;
8
8
  /**
9
9
  * Check is an array is a numeric array (typed array or array of numbers)
10
10
  * @param value value to be tested
11
11
  * @returns input as NumericArray, or null
12
12
  */
13
- export declare function isNumericArray(value: unknown): NumericArray | null;
14
- //# sourceMappingURL=is-array.d.ts.map
13
+ export declare function isNumericArray(value: unknown): value is NumericArray;
package/dist/is-array.js CHANGED
@@ -1,11 +1,22 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Check is an array is a typed array
6
+ * @param value value to be tested
7
+ * @returns input as TypedArray, or null
8
+ */
1
9
  export function isTypedArray(value) {
2
- return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
10
+ return ArrayBuffer.isView(value) && !(value instanceof DataView);
3
11
  }
12
+ /**
13
+ * Check is an array is a numeric array (typed array or array of numbers)
14
+ * @param value value to be tested
15
+ * @returns input as NumericArray, or null
16
+ */
4
17
  export function isNumericArray(value) {
5
- if (Array.isArray(value)) {
6
- return value.length === 0 || typeof value[0] === 'number' ? value : null;
7
- }
8
-
9
- return isTypedArray(value);
18
+ if (Array.isArray(value)) {
19
+ return value.length === 0 || typeof value[0] === 'number';
20
+ }
21
+ return isTypedArray(value);
10
22
  }
11
- //# sourceMappingURL=is-array.js.map
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "version": "4.0.0",
9
+ "version": "4.1.0-alpha.1",
10
10
  "keywords": [
11
11
  "typescript",
12
12
  "javascript",
@@ -23,9 +23,9 @@
23
23
  "module": "dist/index.js",
24
24
  "exports": {
25
25
  ".": {
26
+ "types": "./dist/index.d.ts",
26
27
  "import": "./dist/index.js",
27
- "require": "./dist/index.cjs",
28
- "types": "./dist/index.d.ts"
28
+ "require": "./dist/index.cjs"
29
29
  }
30
30
  },
31
31
  "files": [
@@ -35,5 +35,5 @@
35
35
  "sideEffects": [
36
36
  "./src/bigint.js"
37
37
  ],
38
- "gitHead": "b7af99a25965af5112307552084fbaf5d4d53b7d"
38
+ "gitHead": "1a4dbbc6ab46271459d610411a7c644e45135c2c"
39
39
  }
@@ -1,3 +1,7 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  /**
2
6
  * TypeScript type covering all typed arrays
3
7
  */
@@ -36,4 +40,61 @@ export type NumericArray = TypedArray | number[];
36
40
  * TypeScript type covering all typed arrays and classic arrays consisting of numbers
37
41
  * @note alias for NumericArray
38
42
  */
39
- export type NumberArray = NumericArray;
43
+ export type NumberArray = TypedArray | number[];
44
+
45
+ /** Array with exactly 1 number */
46
+ export type NumberArray1 = [number];
47
+
48
+ /** Array with exactly 2 numbers */
49
+ export type NumberArray2 = [number, number];
50
+
51
+ /** Array with exactly 3 numbers */
52
+ export type NumberArray3 = [number, number, number];
53
+
54
+ /** Array with exactly 4 numbers */
55
+ export type NumberArray4 = [number, number, number, number];
56
+
57
+ /** Array with exactly 6 numbers */
58
+ export type NumberArray6 = [number, number, number, number, number, number];
59
+
60
+ /** Array with exactly 8 numbers */
61
+ export type NumberArray8 = [number, number, number, number, number, number, number, number];
62
+
63
+ /** Array with exactly 9 numbers */
64
+ export type NumberArray9 = [number, number, number, number, number, number, number, number, number];
65
+
66
+ /** Array with exactly 12 numbers */
67
+ export type NumberArray12 = [
68
+ number,
69
+ number,
70
+ number,
71
+ number,
72
+ number,
73
+ number,
74
+ number,
75
+ number,
76
+ number,
77
+ number,
78
+ number,
79
+ number
80
+ ];
81
+
82
+ /** Array with exactly 16 numbers */
83
+ export type NumberArray16 = [
84
+ number,
85
+ number,
86
+ number,
87
+ number,
88
+ number,
89
+ number,
90
+ number,
91
+ number,
92
+ number,
93
+ number,
94
+ number,
95
+ number,
96
+ number,
97
+ number,
98
+ number,
99
+ number
100
+ ];
package/src/bigint.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  // BigInt compatibility layer
2
6
  // Inspired by ArrowJS (under Apache2 license)
3
7
  // https://github.com/apache/arrow/blob/master/js/src/util/compat.ts
@@ -0,0 +1,29 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ /** 2 dimensional bounds [[minX, minY], [maxX, maxY]] */
6
+ export type Bounds2D = [[number, number], [number, number]];
7
+
8
+ /** 3 dimensional bounds [[minX, minY, minZ], [maxX, maxY, maxZ]] */
9
+ export type Bounds3D = [[number, number, number], [number, number, number]];
10
+
11
+ /** 2 or 3 dimensional bounds [[minX, minY], [maxX, maxY]] or [[minX, minY, minZ], [maxX, maxY, maxZ]] */
12
+ export type Bounds =
13
+ | [[number, number], [number, number]]
14
+ | [[number, number, number], [number, number, number]];
15
+
16
+ /** Checks if a `Bounds` is a `Bounds2D` */
17
+ export function isBounds2D(bounds: Bounds): bounds is Bounds2D {
18
+ return bounds.length === 2;
19
+ }
20
+
21
+ /** Accepts 2D and 3D bounds and returns a 2D bound, truncating 3D dimension if necessary */
22
+ export function getBounds2D(bounds: Bounds): Bounds2D {
23
+ return isBounds2D(bounds)
24
+ ? bounds
25
+ : [
26
+ [bounds[0][0], bounds[0][1]],
27
+ [bounds[1][0], bounds[1][1]]
28
+ ];
29
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,22 @@
1
- export type {TypedArray, TypedArrayConstructor, NumericArray, NumberArray} from './array-types';
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export type {
6
+ TypedArray,
7
+ TypedArrayConstructor,
8
+ NumericArray,
9
+ NumberArray,
10
+ NumberArray1,
11
+ NumberArray2,
12
+ NumberArray3,
13
+ NumberArray4,
14
+ NumberArray6,
15
+ NumberArray8,
16
+ NumberArray9,
17
+ NumberArray12,
18
+ NumberArray16
19
+ } from './array-types';
2
20
  export {isTypedArray, isNumericArray} from './is-array';
21
+
22
+ export type {Bounds, Bounds2D, Bounds3D} from './bounds-types';
package/src/is-array.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import {TypedArray, NumericArray} from './array-types';
2
6
 
3
7
  /**
@@ -5,8 +9,8 @@ import {TypedArray, NumericArray} from './array-types';
5
9
  * @param value value to be tested
6
10
  * @returns input as TypedArray, or null
7
11
  */
8
- export function isTypedArray(value: unknown): TypedArray | null {
9
- return ArrayBuffer.isView(value) && !(value instanceof DataView) ? (value as TypedArray) : null;
12
+ export function isTypedArray(value: unknown): value is TypedArray {
13
+ return ArrayBuffer.isView(value) && !(value instanceof DataView);
10
14
  }
11
15
 
12
16
  /**
@@ -14,9 +18,9 @@ export function isTypedArray(value: unknown): TypedArray | null {
14
18
  * @param value value to be tested
15
19
  * @returns input as NumericArray, or null
16
20
  */
17
- export function isNumericArray(value: unknown): NumericArray | null {
21
+ export function isNumericArray(value: unknown): value is NumericArray {
18
22
  if (Array.isArray(value)) {
19
- return value.length === 0 || typeof value[0] === 'number' ? (value as number[]) : null;
23
+ return value.length === 0 || typeof value[0] === 'number';
20
24
  }
21
25
  return isTypedArray(value);
22
26
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"array-types.d.ts","sourceRoot":"","sources":["../src/array-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU,GAClB,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,CAAC;AAMjB,oBAAY,qBAAqB,GAC7B,oBAAoB,GACpB,qBAAqB,GACrB,4BAA4B,GAC5B,qBAAqB,GACrB,sBAAsB,GACtB,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,GACvB,uBAAuB,CAAC;AAE5B;;GAEG;AACH,oBAAY,YAAY,GAAG,UAAU,GAAG,MAAM,EAAE,CAAC;AAEjD;;;GAGG;AACH,oBAAY,WAAW,GAAG,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"array-types.js"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../src/bigint.ts"],"names":[],"mappings":"AAQA,iBAAS,iBAAiB,SAEzB;kBAFQ,iBAAiB;;;;AAU1B,cAAM,wBAAwB;IAC5B,MAAM,KAAK,iBAAiB,WAE3B;IACD,MAAM,CAAC,EAAE;IAGT,MAAM,CAAC,IAAI;;CAMZ;AAED,eAAO,MAAM,eAAe,SAAgC,CAAC;AAC7D,eAAO,MAAM,sBAAsB,SAAuC,CAAC;AAC3E,eAAO,MAAM,uBAAuB,SAAwC,CAAC;AAE7E,QAAA,MAAM,UAAU,8CAEZ,CAAC;AAEL,QAAA,MAAM,iBAAiB,4DAEnB,CAAC;AAEL,QAAA,MAAM,kBAAkB,mEAEpB,CAAC;AAEL,OAAO,EAAC,UAAU,IAAI,MAAM,EAAC,CAAC;AAC9B,OAAO,EAAC,iBAAiB,IAAI,aAAa,EAAC,CAAC;AAC5C,OAAO,EAAC,kBAAkB,IAAI,cAAc,EAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bigint.ts"],"names":["ERR_BIGINT_UNAVAILABLE","BigIntUnavailable","Error","asIntN","asUintN","BigInt64ArrayUnavailable","BYTES_PER_ELEMENT","of","from","constructor","BigIntAvailable","BigInt","BigInt64ArrayAvailable","BigInt64Array","BigUint64ArrayAvailable","BigUint64Array","BigIntCtor","BigInt64ArrayCtor","BigUint64ArrayCtor"],"mappings":"AAMA,MAAMA,sBAAsB,GAAG,6CAA/B;;AAEA,SAASC,iBAAT,GAA6B;AAC3B,QAAM,IAAIC,KAAJ,CAAUF,sBAAV,CAAN;AACD;;AACDC,iBAAiB,CAACE,MAAlB,GAA2B,MAAM;AAC/B,QAAM,IAAID,KAAJ,CAAUF,sBAAV,CAAN;AACD,CAFD;;AAGAC,iBAAiB,CAACG,OAAlB,GAA4B,MAAM;AAChC,QAAM,IAAIF,KAAJ,CAAUF,sBAAV,CAAN;AACD,CAFD;;AAIA,MAAMK,wBAAN,CAA+B;AACD,aAAjBC,iBAAiB,GAAG;AAC7B,WAAO,CAAP;AACD;;AACQ,SAAFC,EAAE,GAAG;AACV,UAAM,IAAIL,KAAJ,CAAUF,sBAAV,CAAN;AACD;;AACU,SAAJQ,IAAI,GAAG;AACZ,UAAM,IAAIN,KAAJ,CAAUF,sBAAV,CAAN;AACD;;AACDS,EAAAA,WAAW,GAAG;AACZ,UAAM,IAAIP,KAAJ,CAAUF,sBAAV,CAAN;AACD;;AAZ4B;;AAe/B,OAAO,MAAMU,eAAe,GAAG,OAAOC,MAAP,KAAkB,WAA1C;AACP,OAAO,MAAMC,sBAAsB,GAAG,OAAOC,aAAP,KAAyB,WAAxD;AACP,OAAO,MAAMC,uBAAuB,GAAG,OAAOC,cAAP,KAA0B,WAA1D;;AAEP,MAAMC,UAAU,GAAG,CAAC,MAAM;AACxB,SAAON,eAAe,GAAGC,MAAH,GAAYV,iBAAlC;AACD,CAFkB,GAAnB;;AAIA,MAAMgB,iBAAiB,GAAG,CAAC,MAAM;AAC/B,SAAOL,sBAAsB,GAAGC,aAAH,GAAmBR,wBAAhD;AACD,CAFyB,GAA1B;;AAIA,MAAMa,kBAAkB,GAAG,CAAC,MAAM;AAChC,SAAOJ,uBAAuB,GAAG,CAACC,cAAD,CAAH,GAAsB,CAACV,wBAAD,CAApD;AACD,CAF0B,GAA3B;;AAIA,SAAQW,UAAU,IAAIL,MAAtB;AACA,SAAQM,iBAAiB,IAAIJ,aAA7B;AACA,SAAQK,kBAAkB,IAAIH,cAA9B","sourcesContent":["// BigInt compatibility layer\n// Inspired by ArrowJS (under Apache2 license)\n// https://github.com/apache/arrow/blob/master/js/src/util/compat.ts\n// Requires tsconfig.json: target=esnext or (lib: esnext.bigint)\n// Requires eslint: env: {es2020: true}\n\nconst ERR_BIGINT_UNAVAILABLE = 'BigInt is not available in this environment';\n\nfunction BigIntUnavailable() {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n}\nBigIntUnavailable.asIntN = () => {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n};\nBigIntUnavailable.asUintN = () => {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n};\n\nclass BigInt64ArrayUnavailable {\n static get BYTES_PER_ELEMENT() {\n return 8;\n }\n static of() {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n }\n static from() {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n }\n constructor() {\n throw new Error(ERR_BIGINT_UNAVAILABLE);\n }\n}\n\nexport const BigIntAvailable = typeof BigInt !== 'undefined';\nexport const BigInt64ArrayAvailable = typeof BigInt64Array !== 'undefined';\nexport const BigUint64ArrayAvailable = typeof BigUint64Array !== 'undefined';\n\nconst BigIntCtor = (() => {\n return BigIntAvailable ? BigInt : BigIntUnavailable;\n})();\n\nconst BigInt64ArrayCtor = (() => {\n return BigInt64ArrayAvailable ? BigInt64Array : BigInt64ArrayUnavailable;\n})();\n\nconst BigUint64ArrayCtor = (() => {\n return BigUint64ArrayAvailable ? [BigUint64Array] : [BigInt64ArrayUnavailable];\n})();\n\nexport {BigIntCtor as BigInt};\nexport {BigInt64ArrayCtor as BigInt64Array};\nexport {BigUint64ArrayCtor as BigUint64Array};\n"],"file":"bigint.js"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAChG,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["isTypedArray","isNumericArray"],"mappings":"SACQA,Y,EAAcC,c","sourcesContent":["export type {TypedArray, TypedArrayConstructor, NumericArray, NumberArray} from './array-types';\nexport {isTypedArray, isNumericArray} from './is-array';\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-array.d.ts","sourceRoot":"","sources":["../src/is-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAKlE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/is-array.ts"],"names":["isTypedArray","value","ArrayBuffer","isView","DataView","isNumericArray","Array","isArray","length"],"mappings":"AAOA,OAAO,SAASA,YAAT,CAAsBC,KAAtB,EAAyD;AAC9D,SAAOC,WAAW,CAACC,MAAZ,CAAmBF,KAAnB,KAA6B,EAAEA,KAAK,YAAYG,QAAnB,CAA7B,GAA6DH,KAA7D,GAAoF,IAA3F;AACD;AAOD,OAAO,SAASI,cAAT,CAAwBJ,KAAxB,EAA6D;AAClE,MAAIK,KAAK,CAACC,OAAN,CAAcN,KAAd,CAAJ,EAA0B;AACxB,WAAOA,KAAK,CAACO,MAAN,KAAiB,CAAjB,IAAsB,OAAOP,KAAK,CAAC,CAAD,CAAZ,KAAoB,QAA1C,GAAsDA,KAAtD,GAA2E,IAAlF;AACD;;AACD,SAAOD,YAAY,CAACC,KAAD,CAAnB;AACD","sourcesContent":["import {TypedArray, NumericArray} from './array-types';\n\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input as TypedArray, or null\n */\nexport function isTypedArray(value: unknown): TypedArray | null {\n return ArrayBuffer.isView(value) && !(value instanceof DataView) ? (value as TypedArray) : null;\n}\n\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input as NumericArray, or null\n */\nexport function isNumericArray(value: unknown): NumericArray | null {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number' ? (value as number[]) : null;\n }\n return isTypedArray(value);\n}\n"],"file":"is-array.js"}