1.0.0 • Published 3 years ago
@suchipi/is v1.0.0
@suchipi/is
Functions for testing the types of JavaScript values, cross-realm. Has testers for all standard built-in objects/values.
Usage
import { is } from "@suchipi/is";
console.log(is.Object({})); // true
console.log(is.Array([])); // true
console.log(is.String(null)); // false
// etcAvailable functions
Stringstring(alias ofString)Number(does not return true forNaN)number(alias ofNumber)Booleanboolean(alias ofBoolean)BigIntbigint(alias ofBigInt)Symbolsymbol(alias ofSymbol)nullundefinedvoidObject(does not return true fornull)object(alias ofObject)ArrayFunctionfunction(alias ofFunction)tagged(Object toString tag checker)instanceOf(same asinstanceof)Error(matches Error subclasses, too)InfinityNegativeInfinityNaNDateRegExpMapSetWeakMapWeakSetArrayBufferSharedArrayBufferDataViewTypedArrayInt8ArrayUint8ArrayUint8ClampedArrayInt16ArrayUint16ArrayInt32ArrayUint32ArrayFloat32ArrayFloat64ArrayPromise(matches any thenable)Generator(only guaranteed to match generators that weren't compiled with Babel or etc)GeneratorFunction(only guaranteed to match generator functions that weren't compiled with Babel or etc)AsyncFunction(only guaranteed to match async functions that weren't compiled with Babel or etc)AsyncGenerator(only guaranteed to match async generators that weren't compiled with Babel or etc)AsyncGeneratorFunction(only guaranteed to match async generator functions that weren't compiled with Babel or etc)
Notes
Two utility types, TypedArray and TypedArrayConstructor, are also exported from this package.
License
MIT
1.0.0
3 years ago