ExtendScript / extendscript-es6-shim

MIT License
30 stars 6 forks source link

Create from.js #4

Closed tracker1 closed 6 years ago

tracker1 commented 6 years ago

Add Array.from polyfill

ff6347 commented 6 years ago

Cool. Thanks for the PR. So what can we convert with this polyfill?

#include "../Array/from.js"
$.writeln(Array.from("foo"));
// => f,o,o
$.writeln(Array.from(app.activeDocument.pages));
// => [object Page]
tracker1 commented 6 years ago

Will look into making it work with strings and indesign collections.

ff6347 commented 6 years ago

IT Works with strings. Would be great if it worked with any kind of collection. Not only InDesign

tracker1 commented 6 years ago

It should work with anything that has a .length property that's numeric and finite, looking at the code.

ff6347 commented 6 years ago

Yes it does. Stupid me. In a new ID document there is only one page! m(

ff6347 commented 6 years ago

And its on the registry https://www.npmjs.com/package/extendscript-es6-shim

ff6347 commented 6 years ago

Thanks