Skip to content

Conversation

jgonggrijp
Copy link
Collaborator

@jgonggrijp jgonggrijp commented May 2, 2020

This is an updated and polished continuation of #2694. Merging this PR will (should?) also merge the other.

@jashkenas I'm requesting your review again because I ended up making quite substantial changes compared to the original PR that you already reviewed:

  • Exports new isArrayBuffer, isDataView and isTypedArray functions. These are also tested.
  • Created an internal isBufferLike function that follows the pattern of isArrayLike (with byteLength instead of length) and factored out the common logic.
  • Moved around and reformulated @maartenbreddels's logic, although I kept the principles and left his tests for isEqual untouched.
  • Added BigInt64Array and BigUint64Array, which probably didn't exist yet in 2018.

I could not entirely avoid listing the typed array constructor names, because typed arrays appeared in IE10 while ArrayBuffer.isView appeared only in IE11. However, I was able to compress the list into a regular expression.

Edit to add: You can support my work on Underscore and other open source projects on Patreon.

@jashkenas
Copy link
Owner

This looks really nice to me! 👏

@jgonggrijp jgonggrijp merged commit 4334c12 into jashkenas:master May 4, 2020
@jgonggrijp jgonggrijp deleted the typed_array_eq branch May 4, 2020 06:06
jgonggrijp added a commit to jgonggrijp/underscore that referenced this pull request Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants