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

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

Fix frontend appearance

  • Property mode set to 100644
File size: 639 bytes
Line 
1import getLength from './_getLength.js';
2import isArray from './isArray.js';
3import isString from './isString.js';
4import isArguments from './isArguments.js';
5import keys from './keys.js';
6
7// Is a given array, string, or object empty?
8// An "empty" object has no enumerable own-properties.
9export default function 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}
Note: See TracBrowser for help on using the repository browser.