Skip to content

Instantly share code, notes, and snippets.

@kanakiyajay
Created August 14, 2014 09:05
Show Gist options
  • Save kanakiyajay/0ef246d6dd9004c1e4ad to your computer and use it in GitHub Desktop.
Save kanakiyajay/0ef246d6dd9004c1e4ad to your computer and use it in GitHub Desktop.
Angular: is the Object array like
function isArrayLike(obj) {
if (obj == null || isWindow(obj)) {
return false;
}
var length = obj.length;
if (obj.nodeType === 1 && length) {
return true;
}
return isString(obj) || isArray(obj) || length === 0 ||
typeof length === 'number' && length > 0 && (length - 1) in obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment