MCPcopy Create free account
hub / github.com/apache/cloudstack / isArrayLike

Function isArrayLike

tools/ngui/static/js/lib/angular.js:76–90  ·  view source on GitHub ↗

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

(obj)

Source from the content-addressed store, hash-verified

74 * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
75 */
76function isArrayLike(obj) {
77 if (!obj || (typeof obj.length !== 'number')) return false;
78
79 // We have on object which has length property. Should we treat it as array?
80 if (typeof obj.hasOwnProperty != 'function' &&
81 typeof obj.constructor != 'function') {
82 // This is here for IE8: it is a bogus object treat it as array;
83 return true;
84 } else {
85 return obj instanceof JQLite || // JQLite
86 (jQuery && obj instanceof jQuery) || // jQuery
87 toString.call(obj) !== '[object Object]' || // some browser native object
88 typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
89 }
90}
91
92
93/**

Callers 1

forEachFunction · 0.85

Calls 1

callMethod · 0.45

Tested by

no test coverage detected