39 lines
925 B
JavaScript
39 lines
925 B
JavaScript
/**
|
|
* @file Determine if a value is object like.
|
|
* @version 1.6.0
|
|
* @author Xotic750 <Xotic750@gmail.com>
|
|
* @copyright Xotic750
|
|
* @license {@link <https://opensource.org/licenses/MIT> MIT}
|
|
* @module is-object-like-x
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var isFunction = require('is-function-x');
|
|
var isPrimitive = require('is-primitive');
|
|
|
|
/**
|
|
* Checks if `value` is object-like. A value is object-like if it's not a
|
|
* primitive and not a function.
|
|
*
|
|
* @param {*} value - The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
* @example
|
|
* var isObjectLike = require('is-object-like-x');
|
|
*
|
|
* isObjectLike({});
|
|
* // => true
|
|
*
|
|
* isObjectLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* isObjectLike(_.noop);
|
|
* // => false
|
|
*
|
|
* isObjectLike(null);
|
|
* // => false
|
|
*/
|
|
module.exports = function isObjectLike(value) {
|
|
return isPrimitive(value) === false && isFunction(value, true) === false;
|
|
};
|