MCPcopy
hub / github.com/Postcatlab/postcat / isArrayLike

Function isArrayLike

src/workbench/browser/src/ng1/lib/angular/angular.js:350–369  ·  view source on GitHub ↗

* @private * @param {*} obj * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, * String ...)

(obj)

Source from the content-addressed store, hash-verified

348 * String ...)
349 */
350 function isArrayLike(obj) {
351
352 // `null`, `undefined` and `window` are not array-like
353 if (obj == null || isWindow(obj)) return false;
354
355 // arrays, strings and jQuery/jqLite objects are array like
356 // * jqLite is either the jQuery or jqLite constructor function
357 // * we have to check the existence of jqLite first as this method is called
358 // via the forEach method when constructing the jqLite object in the first place
359 if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
360
361 // Support: iOS 8.2 (not reproducible in simulator)
362 // "length" in obj used to prevent JIT error (gh-11508)
363 var length = 'length' in Object(obj) && obj.length;
364
365 // NodeList objects (with `item` method) and
366 // other objects with suitable length characteristics are array-like
367 return isNumber(length) && (length >= 0 && (length - 1) in obj || typeof obj.item === 'function');
368
369 }
370
371 /**
372 * @ngdoc function

Callers 8

forEachFunction · 0.85
$watchCollectionActionFunction · 0.85
filterFilterFunction · 0.85
limitToFilterFunction · 0.85
orderByFilterFunction · 0.85
getOptionValuesKeysFunction · 0.85
angular.jsFile · 0.85

Calls 4

isWindowFunction · 0.85
isArrayFunction · 0.85
isStringFunction · 0.85
isNumberFunction · 0.85

Tested by

no test coverage detected