@math.gl/types 4.0.0 → 4.0.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,14 @@
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 = NumericArray;
@@ -1,2 +1 @@
1
1
  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,44 @@
1
+ // BigInt compatibility layer
2
+ // Inspired by ArrowJS (under Apache2 license)
3
+ // https://github.com/apache/arrow/blob/master/js/src/util/compat.ts
4
+ // Requires tsconfig.json: target=esnext or (lib: esnext.bigint)
5
+ // Requires eslint: env: {es2020: true}
1
6
  const ERR_BIGINT_UNAVAILABLE = 'BigInt is not available in this environment';
2
-
3
7
  function BigIntUnavailable() {
4
- throw new Error(ERR_BIGINT_UNAVAILABLE);
8
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
5
9
  }
6
-
7
10
  BigIntUnavailable.asIntN = () => {
8
- throw new Error(ERR_BIGINT_UNAVAILABLE);
11
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
9
12
  };
10
-
11
13
  BigIntUnavailable.asUintN = () => {
12
- throw new Error(ERR_BIGINT_UNAVAILABLE);
14
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
13
15
  };
14
-
15
16
  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
-
17
+ static get BYTES_PER_ELEMENT() {
18
+ return 8;
19
+ }
20
+ static of() {
21
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
22
+ }
23
+ static from() {
24
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
25
+ }
26
+ constructor() {
27
+ throw new Error(ERR_BIGINT_UNAVAILABLE);
28
+ }
32
29
  }
33
-
34
30
  export const BigIntAvailable = typeof BigInt !== 'undefined';
35
31
  export const BigInt64ArrayAvailable = typeof BigInt64Array !== 'undefined';
36
32
  export const BigUint64ArrayAvailable = typeof BigUint64Array !== 'undefined';
37
-
38
33
  const BigIntCtor = (() => {
39
- return BigIntAvailable ? BigInt : BigIntUnavailable;
34
+ return BigIntAvailable ? BigInt : BigIntUnavailable;
40
35
  })();
41
-
42
36
  const BigInt64ArrayCtor = (() => {
43
- return BigInt64ArrayAvailable ? BigInt64Array : BigInt64ArrayUnavailable;
37
+ return BigInt64ArrayAvailable ? BigInt64Array : BigInt64ArrayUnavailable;
44
38
  })();
45
-
46
39
  const BigUint64ArrayCtor = (() => {
47
- return BigUint64ArrayAvailable ? [BigUint64Array] : [BigInt64ArrayUnavailable];
40
+ return BigUint64ArrayAvailable ? [BigUint64Array] : [BigInt64ArrayUnavailable];
48
41
  })();
49
-
50
42
  export { BigIntCtor as BigInt };
51
43
  export { BigInt64ArrayCtor as BigInt64Array };
52
44
  export { BigUint64ArrayCtor as BigUint64Array };
53
- //# sourceMappingURL=bigint.js.map
package/dist/index.cjs CHANGED
@@ -16,15 +16,15 @@ 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
29
  return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
30
30
  }
@@ -34,3 +34,4 @@ function isNumericArray(value) {
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": ["export { isTypedArray, isNumericArray } from \"./is-array.js\";\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) ? value : null;\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' ? value : null;\n }\n return isTypedArray(value);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,SAAS,aAAa,OAAO;AAChC,SAAO,YAAY,OAAO,KAAK,KAAK,EAAE,iBAAiB,YAAY,QAAQ;AAC/E;AAMO,SAAS,eAAe,OAAO;AAClC,MAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,WAAO,MAAM,WAAW,KAAK,OAAO,MAAM,OAAO,WAAW,QAAQ;AAAA,EACxE;AACA,SAAO,aAAa,KAAK;AAC7B;",
6
+ "names": []
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
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 } from "./array-types.js";
2
+ export { isTypedArray, isNumericArray } from "./is-array.js";
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
1
  export { isTypedArray, isNumericArray } from "./is-array.js";
2
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
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
@@ -11,4 +11,3 @@ export declare function isTypedArray(value: unknown): TypedArray | null;
11
11
  * @returns input as NumericArray, or null
12
12
  */
13
13
  export declare function isNumericArray(value: unknown): NumericArray | null;
14
- //# sourceMappingURL=is-array.d.ts.map
package/dist/is-array.js CHANGED
@@ -1,11 +1,19 @@
1
+ /**
2
+ * Check is an array is a typed array
3
+ * @param value value to be tested
4
+ * @returns input as TypedArray, or null
5
+ */
1
6
  export function isTypedArray(value) {
2
- return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
7
+ return ArrayBuffer.isView(value) && !(value instanceof DataView) ? value : null;
3
8
  }
9
+ /**
10
+ * Check is an array is a numeric array (typed array or array of numbers)
11
+ * @param value value to be tested
12
+ * @returns input as NumericArray, or null
13
+ */
4
14
  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);
15
+ if (Array.isArray(value)) {
16
+ return value.length === 0 || typeof value[0] === 'number' ? value : null;
17
+ }
18
+ return isTypedArray(value);
10
19
  }
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.0.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": "33f369ba3a259f79acc3fa8181190c9da8841648"
39
39
  }
@@ -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","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B;;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"}