UNPKG

@w6s/sdk

Version:

WorkPlusFE JavaScript SDK.

49 lines (48 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isFunction = exports.isArray = exports.isPlainObject = exports.isPrimitive = exports.isString = void 0; /** * Checks whether given value's type is a string * @param wat A value to be checked. * @returns A boolean representing the result. */ function isString(wat) { return Object.prototype.toString.call(wat) === '[object String]'; } exports.isString = isString; /** * Checks whether given value's is a primitive (undefined, null, number, boolean, string) * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPrimitive(wat) { return wat === null || (typeof wat !== 'object' && typeof wat !== 'function'); } exports.isPrimitive = isPrimitive; /** * Checks whether given value's type is an object literal * @param wat A value to be checked. * @returns A boolean representing the result. */ function isPlainObject(wat) { return Object.prototype.toString.call(wat) === '[object Object]'; } exports.isPlainObject = isPlainObject; /** * Checks whether given value's type is an array * @param wat A value to be checked. * @returns A boolean representing the result. */ function isArray(wat) { return Object.prototype.toString.call(wat) === '[object Array]'; } exports.isArray = isArray; /** * Checks whether given value's type is a function * @param wat A value to be checked. * @returns A boolean representing the result. */ function isFunction(wat) { return Object.prototype.toString.call(wat) === '[object Function]'; } exports.isFunction = isFunction;