UNPKG

397 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Checks whether a value is an object
5 *
6 * **Aliases** _obj_
7 *
8 * @function object
9 *
10 * @example
11 * var is = require('predicates');
12 *
13 * is.object({}); // true
14 * is.object('object'); // false
15 *
16 * @param {*} value
17 * @returns {Boolean}
18 */
19module.exports = function isObject(value) {
20 return value instanceof Object || (typeof value === 'object' && value !== null);
21};
\No newline at end of file