source: frontend/node_modules/underscore/cjs/isEmpty.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 669 bytes
Line 
1var _getLength = require('./_getLength.js');
2var isArray = require('./isArray.js');
3var isString = require('./isString.js');
4var isArguments = require('./isArguments.js');
5var keys = require('./keys.js');
6
7// Is a given array, string, or object empty?
8// An "empty" object has no enumerable own-properties.
9function isEmpty(obj) {
10 if (obj == null) return true;
11 // Skip the more expensive `toString`-based type checks if `obj` has no
12 // `.length`.
13 var length = _getLength(obj);
14 if (typeof length == 'number' && (
15 isArray(obj) || isString(obj) || isArguments(obj)
16 )) return length === 0;
17 return _getLength(keys(obj)) === 0;
18}
19
20module.exports = isEmpty;
Note: See TracBrowser for help on using the repository browser.