Skip to content

Use Array.isArray instead of instanceof #128

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 26, 2019
Merged

Use Array.isArray instead of instanceof #128

merged 1 commit into from
Apr 26, 2019

Conversation

thegeorgeous
Copy link

instanceof does not always return true for an array even if array.isArray()
return true and Object.prototype.toString() returns [Object Array]

http://blog.niftysnippets.org/2010/09/say-what.html#instanceof
https://stackoverflow.com/questions/28779255/is-instanceof-array-better-than-isarray-in-javascript

Fixes #124

`instanceof` does not always return true for an array even if `array.isArray()`
return true and `Object.prototype.toString()` returns `[Object Array]`

http://blog.niftysnippets.org/2010/09/say-what.html#instanceof
https://stackoverflow.com/questions/28779255/is-instanceof-array-better-than-isarray-in-javascript

Fixes #124
@CacheControl CacheControl merged commit 5a2723f into CacheControl:master Apr 26, 2019
@CacheControl
Copy link
Owner

thanks for the contribution @thegeorgeous , this is now published as v2.3.5

@thegeorgeous thegeorgeous deleted the 124-fix-instanceof branch May 12, 2019 17:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error "any must be an array" even if an array is passed
2 participants