Created
August 14, 2014 09:05
-
-
Save kanakiyajay/0ef246d6dd9004c1e4ad to your computer and use it in GitHub Desktop.
Angular: is the Object array like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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