A ponyfill for the ES 2015 (ES6) `Array.from()`.
npm install @59naga/array.from



array-from
==========
A ponyfill for the ES 2015 [Array.from()][].
* Ponyfill: A polyfill that doesn't overwrite the native method.
* ES 2015: The new name for ES6 that [nobody expected][].
Modeled after the final ES 2015 spec. Credits for the implementation go to the amazing folks of the MDN and the amazing guy @barberboy.
[Array.from()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from "Array.from()"
[nobody expected]: http://webreflection.blogspot.de/2015/01/javascript-and-living-ecmascript.html "JavaScript and the living ECMAScript Standard"
Installation
------------
``sh`
$ npm install array-from
Usage
-----
Recommended:
`jsArray.from
var arrayFrom = require('array-from');
// You’ll get the native if it’s available.
function () {console.log(
arrayFrom(arguments).map(require('1-liners/increment'))
);}(1, 2, 3);
//» [2, 3, 4]
`
You can also use it as a classical polyfill. It’s [not recommended][], but sometimes practical:
`js
if (!Array.from) Array.from = require('array-from');
// This will affect all loaded modules.
function () {console.log(
Array.from(arguments).map(require('1-liners/increment'))
);}(1, 2, 3);
//» [2, 3, 4]
``
[not recommended]: https://github.com/sindresorhus/object-assign/issues/10#issuecomment-65065859 "Optionally shim native method?"
License
-------
[MIT][] © [Studio B12 GmbH][]
[MIT]: ./License.md
[Studio B12 GmbH]: https://github.com/studio-b12