UNPKG

space-lift

Version:

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

36 lines (35 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.object = exports.boolean = exports.number = exports.string = exports.func = exports.defined = exports.array = void 0; /** Returns whether an object is an Array */ exports.array = Array.isArray; /** Returns whether this object is neither null or undefined */ function defined(obj) { return obj !== null && obj !== undefined; } exports.defined = defined; /** Returns whether this object is a function */ function func(obj) { return typeof obj === 'function'; } exports.func = func; /** Returns whether this object is a string */ function string(obj) { return typeof obj === 'string'; } exports.string = string; /** Returns whether this object is a number */ function number(obj) { return typeof obj === 'number'; } exports.number = number; /** Returns whether this object is a boolean */ function boolean(obj) { return typeof obj === 'boolean'; } exports.boolean = boolean; /** Returns whether this value is a plain object */ function object(obj) { return Object.getPrototypeOf(obj) === Object.prototype; } exports.object = object;