UNPKG

space-lift

Version:

TypeScript Array, Object, Map, Set, Union, Enum utils

27 lines (26 loc) 833 B
/** Returns whether an object is an Array */ export const array = Array.isArray; /** Returns whether this object is neither null or undefined */ export function defined(obj) { return obj !== null && obj !== undefined; } /** Returns whether this object is a function */ export function func(obj) { return typeof obj === 'function'; } /** Returns whether this object is a string */ export function string(obj) { return typeof obj === 'string'; } /** Returns whether this object is a number */ export function number(obj) { return typeof obj === 'number'; } /** Returns whether this object is a boolean */ export function boolean(obj) { return typeof obj === 'boolean'; } /** Returns whether this value is a plain object */ export function object(obj) { return Object.getPrototypeOf(obj) === Object.prototype; }