dd7e0ce1776a8876f2507d609bbe3c55555d6063
[yaffs-website] / node_modules / uncss / node_modules / lodash / isEmpty.js
1 var isFunction = require('./isFunction'),
2     isObjectLike = require('./isObjectLike'),
3     keys = require('./keys'),
4     size = require('./size');
5
6 /**
7  * Checks if `value` is empty. A value is considered empty unless it's an
8  * `arguments` object, array, string, or jQuery-like collection with a length
9  * greater than `0` or an object with own enumerable properties.
10  *
11  * @static
12  * @memberOf _
13  * @category Lang
14  * @param {Array|Object|string} value The value to inspect.
15  * @returns {boolean} Returns `true` if `value` is empty, else `false`.
16  * @example
17  *
18  * _.isEmpty(null);
19  * // => true
20  *
21  * _.isEmpty(true);
22  * // => true
23  *
24  * _.isEmpty(1);
25  * // => true
26  *
27  * _.isEmpty([1, 2, 3]);
28  * // => false
29  *
30  * _.isEmpty({ 'a': 1 });
31  * // => false
32  */
33 function isEmpty(value) {
34   return (!isObjectLike(value) || isFunction(value.splice))
35     ? !size(value)
36     : !keys(value).length;
37 }
38
39 module.exports = isEmpty;