MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / isArrayLike

Function isArrayLike

OpenReservation/wwwroot/Scripts/angular.js:252–270  ·  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

250 * String ...)
251 */
252 function isArrayLike(obj) {
253 // `null`, `undefined` and `window` are not array-like
254 if (obj == null || isWindow(obj)) return false;
255
256 // arrays, strings and jQuery/jqLite objects are array like
257 // * jqLite is either the jQuery or jqLite constructor function
258 // * we have to check the existence of jqLite first as this method is called
259 // via the forEach method when constructing the jqLite object in the first place
260 if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
261
262 // Support: iOS 8.2 (not reproducible in simulator)
263 // "length" in obj used to prevent JIT error (gh-11508)
264 var length = "length" in Object(obj) && obj.length;
265
266 // NodeList objects (with `item` method) and
267 // other objects with suitable length characteristics are array-like
268 return isNumber(length) &&
269 (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
270 }
271
272 /**
273 * @ngdoc function

Callers 7

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

Calls 3

isWindowFunction · 0.85
isStringFunction · 0.85
isNumberFunction · 0.85

Tested by

no test coverage detected