The one that I use is

function isArrayLike(i){
    return (typeof i !=="string") && i.length !== void (0);
}

It might not be perfect, but it allows me to make certain assumptions
about the input that are useful enough. Keep in mind that an Array may
have a length of 5, and all those values are undefined, so  {length:4}
could be used as a valid arrayLike, and that seems reasonable to me.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to