Package Exports
- @openinf/util-types
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openinf/util-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@openinf/util-types
Fundamental JavaScript type-related utilities
The high-level goal of @openinf/util-types
is to serve as a Node.js
package containing utilities for fundamental JavaScript type-related
operations primarily enabling users to perform native typechecking and
simplify type coercion. As is the case with any software project in continuous
development, omissions and errors may exist, for which contributions are
welcome.
Installation
@openinf/util-types
runs on Node.js and is available via npm
.
npm install @openinf/util-types
Usage
Import the helper functions based on your platform.
import { isObject } from '@openinf/util-types';
const maybeObject = null;
if (isObject(maybeObject)) {
console.log('The value of `maybeObject` is actually an Object.');
} else {
console.log('The value of `maybeObject` not an Object.');
}
Functions
- toString(value) ⇒
string
Returns the ECMA [[Class]] of a value.
- isArray(value) ⇒
boolean
Determines if value is actually an Array.
- toArray(arrayLike) ⇒
Array.<T>
Converts an array-like object to an array.
- isObject(value) ⇒
boolean
Determines if value is actually an Object.
- isFiniteNumber(value) ⇒
boolean
Determines if value is of number type and finite. NaN and Infinity are not considered a finite number. String numbers are not considered numbers.
- _isObjectLike(value) ⇒
boolean
Determines if value is actually object-like.
- _isFunctionLike(value) ⇒
boolean
Determines if value is actually function-like.
- isAnyArrayBuffer(value) ⇒
boolean
Determines if value is actually an ArrayBuffer or SharedArrayBuffer.
- isArrayBufferView(value) ⇒
boolean
Determines if value is actually an ArrayBufferView.
- isArgumentsObject(value) ⇒
boolean
Determines if value is actually an Arguments object.
- isArrayBuffer(value) ⇒
boolean
Determines if value is actually an ArrayBuffer.
- isAsyncFunction(value) ⇒
boolean
Determines if value is actually an AsyncFunction.
- isBigInt64Array(value) ⇒
boolean
Determines if value is actually a BigInt64Array.
- isBigUint64Array(value) ⇒
boolean
Determines if value is actually a BigUint64Array.
- isBooleanObject(value) ⇒
boolean
Determines if value is actually a Boolean object.
- isBoxedPrimitive(value) ⇒
boolean
Determines if value is actually one of the boxed primitives:
- Boolean
- String
- Number
- Symbol
- BigInt
- isDataView(value) ⇒
boolean
Determines if value is actually a DataView.
- isDate(value) ⇒
boolean
Determines if value is actually a Date.
- isFloat32Array(value) ⇒
boolean
Determines if value is actually a Float32Array.
- isFloat64Array(value) ⇒
boolean
Determines if value is actually a Float64Array.
- isGeneratorFunction(value) ⇒
boolean
Determines if value is actually a GeneratorFunction.
- isGeneratorObject(value) ⇒
boolean
Determines if value is actually a Generator object.
- isInt8Array(value) ⇒
boolean
Determines if value is actually a Int8Array.
- isInt16Array(value) ⇒
boolean
Determines if value is actually a Int16Array.
- isInt32Array(value) ⇒
boolean
Determines if value is actually a isInt32Array.
- isMap(value) ⇒
boolean
Determines if value is actually a Map.
- isMapIterator(value) ⇒
boolean
Determines if value is actually a Map Iterator.
- isModuleNamespaceObject(value) ⇒
boolean
Determines if value is actually a Module namespace object.
- isNativeError(value) ⇒
boolean
Determines if value is actually a native Error.
- isNumberObject(value) ⇒
boolean
Determines if value is actually a Number object.
- isBigIntObject(value) ⇒
boolean
Determines if value is actually a BigInt object.
- isPromise(value) ⇒
boolean
Determines if value is actually a Promise.
- isRegExp(value) ⇒
boolean
Determines if value is actually a RegExp.
- isSet(value) ⇒
boolean
Determines if value is actually a Set.
- isSetIterator(value) ⇒
boolean
Determines if value is actually a Set Iterator.
- isSharedArrayBuffer(value) ⇒
boolean
Determines if value is actually a SharedArrayBuffer.
- isStringObject(value) ⇒
boolean
Determines if value is actually a String object.
- isSymbolObject(value) ⇒
boolean
Determines if value is actually a Symbol object.
- isTypedArray(value) ⇒
boolean
Determines if value is one of the typed arrays.
- isUint8Array(value) ⇒
boolean
Determines if value is actually a Uint8Array.
- isUint8ClampedArray(value) ⇒
boolean
Determines if value is actually a Uint8ClampedArray.
- isUint16Array(value) ⇒
boolean
Determines if value is actually a Uint16Array.
- isUint32Array(value) ⇒
boolean
Determines if value is actually a Uint32Array.
- isWeakMap(value) ⇒
boolean
Determines if value is actually a WeakMap.
- isWeakSet(value) ⇒
boolean
Determines if value is actually a WeakSet.
toString(value) ⇒ string
Returns the ECMA [[Class]] of a value.
Kind: global function
Param | Type |
---|---|
value | unknown |
isArray(value) ⇒ boolean
Determines if value is actually an Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
toArray(arrayLike) ⇒ Array.<T>
Converts an array-like object to an array.
Kind: global function
Param | Type |
---|---|
arrayLike | ArrayLike.<T> | string |
isObject(value) ⇒ boolean
Determines if value is actually an Object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isFiniteNumber(value) ⇒ boolean
Determines if value is of number type and finite. NaN and Infinity are not considered a finite number. String numbers are not considered numbers.
Kind: global function
Param | Type |
---|---|
value | unknown |
_isObjectLike(value) ⇒ boolean
Determines if value is actually object-like.
Kind: global function
Internal:
Param | Type |
---|---|
value | unknown |
_isFunctionLike(value) ⇒ boolean
Determines if value is actually function-like.
Kind: global function
Internal:
Param | Type |
---|---|
value | unknown |
isAnyArrayBuffer(value) ⇒ boolean
Determines if value is actually an ArrayBuffer or SharedArrayBuffer.
Kind: global function
Param | Type |
---|---|
value | unknown |
isArrayBufferView(value) ⇒ boolean
Determines if value is actually an ArrayBufferView.
Kind: global function
Param | Type |
---|---|
value | unknown |
isArgumentsObject(value) ⇒ boolean
Determines if value is actually an Arguments object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isArrayBuffer(value) ⇒ boolean
Determines if value is actually an ArrayBuffer.
Kind: global function
Param | Type |
---|---|
value | unknown |
isAsyncFunction(value) ⇒ boolean
Determines if value is actually an AsyncFunction.
Kind: global function
Param | Type |
---|---|
value | unknown |
isBigInt64Array(value) ⇒ boolean
Determines if value is actually a BigInt64Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isBigUint64Array(value) ⇒ boolean
Determines if value is actually a BigUint64Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isBooleanObject(value) ⇒ boolean
Determines if value is actually a Boolean object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isBoxedPrimitive(value) ⇒ boolean
Determines if value is actually one of the boxed primitives:
- Boolean
- String
- Number
- Symbol
- BigInt
Kind: global function
Param | Type |
---|---|
value | unknown |
isDataView(value) ⇒ boolean
Determines if value is actually a DataView.
Kind: global function
Param | Type |
---|---|
value | unknown |
isDate(value) ⇒ boolean
Determines if value is actually a Date.
Kind: global function
Param | Type |
---|---|
value | unknown |
isFloat32Array(value) ⇒ boolean
Determines if value is actually a Float32Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isFloat64Array(value) ⇒ boolean
Determines if value is actually a Float64Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isGeneratorFunction(value) ⇒ boolean
Determines if value is actually a GeneratorFunction.
Kind: global function
Param | Type |
---|---|
value | unknown |
isGeneratorObject(value) ⇒ boolean
Determines if value is actually a Generator object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isInt8Array(value) ⇒ boolean
Determines if value is actually a Int8Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isInt16Array(value) ⇒ boolean
Determines if value is actually a Int16Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isInt32Array(value) ⇒ boolean
Determines if value is actually a isInt32Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isMap(value) ⇒ boolean
Determines if value is actually a Map.
Kind: global function
Param | Type |
---|---|
value | unknown |
isMapIterator(value) ⇒ boolean
Determines if value is actually a Map Iterator.
Kind: global function
Param | Type |
---|---|
value | unknown |
isModuleNamespaceObject(value) ⇒ boolean
Determines if value is actually a Module namespace object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isNativeError(value) ⇒ boolean
Determines if value is actually a native Error.
Kind: global function
Param | Type |
---|---|
value | unknown |
isNumberObject(value) ⇒ boolean
Determines if value is actually a Number object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isBigIntObject(value) ⇒ boolean
Determines if value is actually a BigInt object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isPromise(value) ⇒ boolean
Determines if value is actually a Promise.
Kind: global function
Param | Type |
---|---|
value | unknown |
isRegExp(value) ⇒ boolean
Determines if value is actually a RegExp.
Kind: global function
Param | Type |
---|---|
value | unknown |
isSet(value) ⇒ boolean
Determines if value is actually a Set.
Kind: global function
Param | Type |
---|---|
value | unknown |
isSetIterator(value) ⇒ boolean
Determines if value is actually a Set Iterator.
Kind: global function
Param | Type |
---|---|
value | unknown |
isSharedArrayBuffer(value) ⇒ boolean
Determines if value is actually a SharedArrayBuffer.
Kind: global function
Param | Type |
---|---|
value | unknown |
isStringObject(value) ⇒ boolean
Determines if value is actually a String object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isSymbolObject(value) ⇒ boolean
Determines if value is actually a Symbol object.
Kind: global function
Param | Type |
---|---|
value | unknown |
isTypedArray(value) ⇒ boolean
Determines if value is one of the typed arrays.
Kind: global function
Param | Type |
---|---|
value | unknown |
isTypedArray~reTypedTag
Used to match toStringTag
values of typed arrays.
Kind: inner constant of isTypedArray
isUint8Array(value) ⇒ boolean
Determines if value is actually a Uint8Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isUint8ClampedArray(value) ⇒ boolean
Determines if value is actually a Uint8ClampedArray.
Kind: global function
Param | Type |
---|---|
value | unknown |
isUint16Array(value) ⇒ boolean
Determines if value is actually a Uint16Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isUint32Array(value) ⇒ boolean
Determines if value is actually a Uint32Array.
Kind: global function
Param | Type |
---|---|
value | unknown |
isWeakMap(value) ⇒ boolean
Determines if value is actually a WeakMap.
Kind: global function
Param | Type |
---|---|
value | unknown |
isWeakSet(value) ⇒ boolean
Determines if value is actually a WeakSet.
Kind: global function
Param | Type |
---|---|
value | unknown |
© OpenINF