Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A robust & optimized ES3-compatible polyfill for the `Array.from` method in ECMAScript 6.

License

NotificationsYou must be signed in to change notification settings

mathiasbynens/Array.from

Repository files navigation

Build Statusdependency statusdev dependency statusLicenseDownloads

npm badge

A spec-compliantArray.from shim/polyfill/replacement that works as far down as ES3.

This package implements thees-shim API interface. It works in an ES3-supported environment and complies with the proposedspec.

TheArray.from() method creates a new Array instance from an array-like or iterable object.

Installation

npm install array.from

Example

varfrom=require('array.from');varassert=require('assert');assert.deepEqual(from('abc'),['a','b','c']);
varfrom=require('array.from');varassert=require('assert');/* when Array#from is not present */deleteArray.from;varshimmedFrom=from.shim();assert.equal(shimmedFrom,from.getPolyfill());assert.deepEqual(Array.from('foo'),from('foo'));
varfrom=require('array.from');varassert=require('assert');/* when Array#from is present */varshimmedFrom=from.shim();assert.equal(shimmedFrom,Array.from);assert.deepEqual(Array.from('abc'),from('abc'));

Tests

Simply clone the repo,npm install, and runnpm test

Author

twitter/mathias
Mathias Bynens

License

This polyfill is available under theMIT license.

About

A robust & optimized ES3-compatible polyfill for the `Array.from` method in ECMAScript 6.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp