# Array.from **Repository Path**: mirrors_ljharb/Array.from ## Basic Information - **Project Name**: Array.from - **Description**: A robust & optimized ES3-compatible polyfill for the `Array.from` method in ECMAScript 6. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-06-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Array.from [![Version Badge][npm-version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] A spec-compliant `Array.from` shim/polyfill/replacement that works as far down as ES3. This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the proposed [spec](http://www.ecma-international.org/ecma-262/6.0/#sec-array.from). The `Array.from()` method creates a new Array instance from an array-like or iterable object. ## Installation ```bash npm install array.from ``` ## Example ```js var from = require('array.from'); var assert = require('assert'); assert.deepEqual(from('abc'), ['a', 'b', 'c']); ``` ```js var from = require('array.from'); var assert = require('assert'); /* when Array#from is not present */ delete Array.from; var shimmedFrom = from.shim(); assert.equal(shimmedFrom, from.getPolyfill()); assert.deepEqual(Array.from('foo'), from('foo')); ``` ```js var from = require('array.from'); var assert = require('assert'); /* when Array#from is present */ var shimmedFrom = from.shim(); assert.equal(shimmedFrom, Array.from); assert.deepEqual(Array.from('abc'), from('abc')); ``` ## Tests Simply clone the repo, `npm install`, and run `npm test` ## Author | [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | |---| | [Mathias Bynens](https://mathiasbynens.be/) | ## License This polyfill is available under the [MIT](https://mths.be/mit) license. [package-url]: https://npmjs.org/package/array.from [npm-version-svg]: http://versionbadg.es/mathiasbynens/Array.from.svg [travis-svg]: https://travis-ci.org/mathiasbynens/Array.from.svg [travis-url]: https://travis-ci.org/mathiasbynens/Array.from [deps-svg]: https://david-dm.org/mathiasbynens/Array.from.svg [deps-url]: https://david-dm.org/mathiasbynens/Array.from [dev-deps-svg]: https://david-dm.org/mathiasbynens/Array.from/dev-status.svg [dev-deps-url]: https://david-dm.org/mathiasbynens/Array.from#info=devDependencies [npm-badge-png]: https://nodei.co/npm/array.from.png?downloads=true&stars=true [license-image]: http://img.shields.io/npm/l/array.from.svg [license-url]: LICENSE [downloads-image]: http://img.shields.io/npm/dm/array.from.svg [downloads-url]: http://npm-stat.com/charts.html?package=array.from