UNPKG

@extra-array/from

Version:
45 lines (32 loc) 1.28 kB
Converts iterable to array. [:package:](https://www.npmjs.com/package/@extra-array/from) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/from) [:vhs:](https://asciinema.org/a/332054) [:moon:](https://www.npmjs.com/package/@extra-array/from.min) [:scroll:](https://unpkg.com/@extra-array/from/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Alternatives: [from], [from$], [fromRange], [fromApply]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.from(x); // x: an iterable ``` ```javascript const array = require("extra-array"); var x = [1, 2].values(); array.from(x); // [ 1, 2 ] ``` <br> <br> ## References - [Symbol.iterator: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator) - [Array.from: sugarjs](https://sugarjs.com/docs/#/ES6/Array/from) [from]: https://github.com/nodef/extra-array/wiki/from [fromRange]: https://github.com/nodef/extra-array/wiki/fromRange [fromApply]: https://github.com/nodef/extra-array/wiki/fromApply [from$]: https://github.com/nodef/extra-array/wiki/from$