aurelia / polyfills

The minimal set of polyfills needed to run Aurelia.
MIT License
26 stars 27 forks source link

fix(array): make Array.from work with mapping functions #35

Closed AStoker closed 8 years ago

AStoker commented 8 years ago

Issue referenced at: https://github.com/aurelia/polyfills/issues/4#issuecomment-246473333 Previous behavior resulted in errors thrown when passing a mapping function to the polyfill Array.from This allows you to properly allow a mapping function and a “thisArg” to follow spec listed (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)

jods4 commented 8 years ago

A quick look at the code, it seems to me that the bug was on line 32, where the iter parameter was missing. L32: iterCall(mapfn, step.value, index) should have been iterCall(iterator, mapfn, step.value, index)

AStoker commented 8 years ago

Thanks for clearing things up. That was one of the things that was wrong, but we also needed to return the result of the map function too, otherwise it'll set each result of the array to be undefined. I'll get that update in real quick.

AStoker commented 8 years ago

How do those changes look @jods4?

jods4 commented 8 years ago

You are right, the return was missing as well. Looks good to me now.

AStoker commented 8 years ago

@EisenbergEffect, can we get this merged, pending your review?

EisenbergEffect commented 8 years ago

Ok, it's merged. Give me another few minutes and I'll have a patch release out.