source: frontend/node_modules/underscore/amd/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: 626 bytes
Line 
1define(['./_getLength', './isArray', './isString', './isArguments', './keys'], function (_getLength, isArray, isString, isArguments, keys) {
2
3 // Is a given array, string, or object empty?
4 // An "empty" object has no enumerable own-properties.
5 function isEmpty(obj) {
6 if (obj == null) return true;
7 // Skip the more expensive `toString`-based type checks if `obj` has no
8 // `.length`.
9 var length = _getLength(obj);
10 if (typeof length == 'number' && (
11 isArray(obj) || isString(obj) || isArguments(obj)
12 )) return length === 0;
13 return _getLength(keys(obj)) === 0;
14 }
15
16 return isEmpty;
17
18});
Note: See TracBrowser for help on using the repository browser.