mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
more work
This commit is contained in:
49
node_modules/lodash/lang/isEmpty.js
generated
vendored
Normal file
49
node_modules/lodash/lang/isEmpty.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
var getLength = require('../internal/getLength'),
|
||||
isArguments = require('./isArguments'),
|
||||
isArray = require('./isArray'),
|
||||
isFunction = require('./isFunction'),
|
||||
isLength = require('../internal/isLength'),
|
||||
isObjectLike = require('../internal/isObjectLike'),
|
||||
isString = require('./isString'),
|
||||
keys = require('../object/keys');
|
||||
|
||||
/**
|
||||
* Checks if `value` is empty. A value is considered empty unless it is an
|
||||
* `arguments` object, array, string, or jQuery-like collection with a length
|
||||
* greater than `0` or an object with own enumerable properties.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {Array|Object|string} value The value to inspect.
|
||||
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isEmpty(null);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty(true);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty(1);
|
||||
* // => true
|
||||
*
|
||||
* _.isEmpty([1, 2, 3]);
|
||||
* // => false
|
||||
*
|
||||
* _.isEmpty({ 'a': 1 });
|
||||
* // => false
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
if (value == null) {
|
||||
return true;
|
||||
}
|
||||
var length = getLength(value);
|
||||
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||
|
||||
(isObjectLike(value) && isFunction(value.splice)))) {
|
||||
return !length;
|
||||
}
|
||||
return !keys(value).length;
|
||||
}
|
||||
|
||||
module.exports = isEmpty;
|
Reference in New Issue
Block a user