montagejs / collections

This package contains JavaScript implementations of common data structures with idiomatic interfaces.
http://www.collectionsjs.com
Other
2.09k stars 185 forks source link

Don't shim Array.from if it already exists #212

Open justinr1234 opened 5 years ago

hthetiot commented 3 years ago

Fixed by https://github.com/montagejs/collections/commit/85f00f8776e8ece7a6dbb43c47e489d0b14eaca6

hthetiot commented 3 years ago

@marchant i think you do use native Array.from when available on master already: https://github.com/montagejs/collections/commit/85f00f8776e8ece7a6dbb43c47e489d0b14eaca6

If you agree we can close this issue once new version on npm.

justinr1234 commented 3 years ago

@hthetiot a question:

Why shim Array.from at all if a native one exists? I looked at the code and it seems to be checking all sorts of things and still reimplementing Array.from (even though it calls the native one).

Why not just skip the shim altogether if the default exists?

marchant commented 3 years ago

To offer backward compatibility for cases that go beyond the behavior/signature of the native one, which came to be after collections’ if I remember correctly

Sent from my iPhone

On Aug 12, 2021, at 4:26 AM, justinr1234 @.***> wrote:

 @hthetiot a question:

Why shim Array.from at all if a native one exists? I looked at the code and it seems to be checking all sorts of things and still reimplementing Array.from (even though it calls the native one).

Why not just skip the shim altogether if the default exists?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.