@newdash/newdash
Version:
javascript/typescript utility library
35 lines (34 loc) • 840 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isObject = void 0;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @since 5.6.0
* @category Lang
* @param value The value to check.
* @returns Returns `true` if `value` is an object, else `false`.
* @example
*
* ```js
* isObject({})
* // => true
*
* isObject([1, 2, 3])
* // => true
*
* isObject(Function)
* // => true
*
* isObject(null)
* // => false
* ```
*/
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function");
}
exports.isObject = isObject;
exports.default = isObject;