Last active
August 4, 2016 23:54
-
-
Save ryanmorr/ad5e406f62f67a30d30c9d7015c4d5d4 to your computer and use it in GitHub Desktop.
Check if an object has the characteristics of an array-like object
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(value) { | |
return value | |
&& typeof value === 'object' | |
&& typeof value.length === 'number' | |
&& value.length >= 0 | |
&& value.length % 1 === 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment