@math.gl/types
Advanced tools
Comparing version 4.1.0-alpha.1 to 4.1.0-alpha.2
@@ -11,6 +11,6 @@ /** | ||
/** | ||
* TypeScript type covering all typed arrays and classic arrays consisting of numbers | ||
* @note alias for NumericArray | ||
* TypeScript type for classic arrays consisting of numbers | ||
* @note Included for completeness / orthogonality, prefer `number[]` in actual use | ||
*/ | ||
export type NumberArray = TypedArray | number[]; | ||
export type NumberArray = number[]; | ||
/** Array with exactly 1 number */ | ||
@@ -17,0 +17,0 @@ export type NumberArray1 = [number]; |
export type { TypedArray, TypedArrayConstructor, NumericArray, NumberArray, NumberArray1, NumberArray2, NumberArray3, NumberArray4, NumberArray6, NumberArray8, NumberArray9, NumberArray12, NumberArray16 } from "./array-types.js"; | ||
export { isTypedArray, isNumericArray } from "./is-array.js"; | ||
export { isTypedArray, isNumberArray, isNumericArray } from "./is-array.js"; | ||
export type { Bounds, Bounds2D, Bounds3D } from "./bounds-types.js"; |
// math.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
export { isTypedArray, isNumericArray } from "./is-array.js"; | ||
export { isTypedArray, isNumberArray, isNumericArray } from "./is-array.js"; |
@@ -1,13 +0,19 @@ | ||
import { TypedArray, NumericArray } from "./array-types.js"; | ||
import { TypedArray, NumericArray, NumberArray } from "./array-types.js"; | ||
/** | ||
* Check is an array is a typed array | ||
* @param value value to be tested | ||
* @returns input as TypedArray, or null | ||
* @returns input with type narrowed to TypedArray, or null | ||
*/ | ||
export declare function isTypedArray(value: unknown): value is TypedArray; | ||
/** | ||
* Check is an array is an array of numbers) | ||
* @param value value to be tested | ||
* @returns input with type narrowed to NumberArray, or null | ||
*/ | ||
export declare function isNumberArray(value: unknown): value is NumberArray; | ||
/** | ||
* Check is an array is a numeric array (typed array or array of numbers) | ||
* @param value value to be tested | ||
* @returns input as NumericArray, or null | ||
* @returns input with type narrowed to NumericArray, or null | ||
*/ | ||
export declare function isNumericArray(value: unknown): value is NumericArray; |
@@ -7,3 +7,3 @@ // math.gl | ||
* @param value value to be tested | ||
* @returns input as TypedArray, or null | ||
* @returns input with type narrowed to TypedArray, or null | ||
*/ | ||
@@ -14,11 +14,19 @@ export function isTypedArray(value) { | ||
/** | ||
* Check is an array is a numeric array (typed array or array of numbers) | ||
* Check is an array is an array of numbers) | ||
* @param value value to be tested | ||
* @returns input as NumericArray, or null | ||
* @returns input with type narrowed to NumberArray, or null | ||
*/ | ||
export function isNumericArray(value) { | ||
export function isNumberArray(value) { | ||
if (Array.isArray(value)) { | ||
return value.length === 0 || typeof value[0] === 'number'; | ||
} | ||
return isTypedArray(value); | ||
return false; | ||
} | ||
/** | ||
* Check is an array is a numeric array (typed array or array of numbers) | ||
* @param value value to be tested | ||
* @returns input with type narrowed to NumericArray, or null | ||
*/ | ||
export function isNumericArray(value) { | ||
return isTypedArray(value) || isNumberArray(value); | ||
} |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "4.1.0-alpha.1", | ||
"version": "4.1.0-alpha.2", | ||
"keywords": [ | ||
@@ -39,3 +39,3 @@ "typescript", | ||
], | ||
"gitHead": "1a4dbbc6ab46271459d610411a7c644e45135c2c" | ||
"gitHead": "59eb434870991d06aecff5b1dee38078af0ca447" | ||
} |
@@ -40,6 +40,6 @@ // math.gl | ||
/** | ||
* TypeScript type covering all typed arrays and classic arrays consisting of numbers | ||
* @note alias for NumericArray | ||
* TypeScript type for classic arrays consisting of numbers | ||
* @note Included for completeness / orthogonality, prefer `number[]` in actual use | ||
*/ | ||
export type NumberArray = TypedArray | number[]; | ||
export type NumberArray = number[]; | ||
@@ -46,0 +46,0 @@ /** Array with exactly 1 number */ |
@@ -26,5 +26,5 @@ // math.gl | ||
: [ | ||
[bounds[0][0], bounds[0][1]], | ||
[bounds[1][0], bounds[1][1]] | ||
]; | ||
[bounds[0][0], bounds[0][1]], | ||
[bounds[1][0], bounds[1][1]] | ||
]; | ||
} |
@@ -20,4 +20,5 @@ // math.gl | ||
} from './array-types'; | ||
export {isTypedArray, isNumericArray} from './is-array'; | ||
export {isTypedArray, isNumberArray, isNumericArray} from './is-array'; | ||
export type {Bounds, Bounds2D, Bounds3D} from './bounds-types'; |
@@ -5,3 +5,3 @@ // math.gl | ||
import {TypedArray, NumericArray} from './array-types'; | ||
import {TypedArray, NumericArray, NumberArray} from './array-types'; | ||
@@ -11,3 +11,3 @@ /** | ||
* @param value value to be tested | ||
* @returns input as TypedArray, or null | ||
* @returns input with type narrowed to TypedArray, or null | ||
*/ | ||
@@ -19,11 +19,20 @@ export function isTypedArray(value: unknown): value is TypedArray { | ||
/** | ||
* Check is an array is a numeric array (typed array or array of numbers) | ||
* Check is an array is an array of numbers) | ||
* @param value value to be tested | ||
* @returns input as NumericArray, or null | ||
* @returns input with type narrowed to NumberArray, or null | ||
*/ | ||
export function isNumericArray(value: unknown): value is NumericArray { | ||
export function isNumberArray(value: unknown): value is NumberArray { | ||
if (Array.isArray(value)) { | ||
return value.length === 0 || typeof value[0] === 'number'; | ||
} | ||
return isTypedArray(value); | ||
return false; | ||
} | ||
/** | ||
* Check is an array is a numeric array (typed array or array of numbers) | ||
* @param value value to be tested | ||
* @returns input with type narrowed to NumericArray, or null | ||
*/ | ||
export function isNumericArray(value: unknown): value is NumericArray { | ||
return isTypedArray(value) || isNumberArray(value); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22428
462