# core-js
[![Spo
nsors on Open Collective](https://opencollective.com/core-js/sponsors/badge.svg)](#raising-funds) [![Backers on Open Collective](https://opencollective.com/core-js/backers/badge.svg)](#raising-funds) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zloirock/core-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_co
ntent=badge) [![version](https://img.shields.io/npm/v/core-js.svg)](https://www.npmjs.com/package/core-js) [![npm downloads](https://img.shields.io/npm/dm/core-js.svg)](http://npm-stat.com/charts.html?package=core-js&author=&from=2014-11-18) [![Build Status](https://travis-ci.org/zloirock/core-js.svg)](https://travis-ci.org/zloirock/core-js) [![devDependency status](https://david-dm.org/zloirock/core-js/dev-status.svg)](https://david-dm.org/zloirock/core-js?type=dev)
## As advertising: the author is looking for a good job :)
## [core-js@3, babel and a look into the future](https://github.com/zloirock/core-js/tree/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md)
## Raising funds
`core-js` isn't backed by a company, so the future of this project depends on you. Become a spo
nsor or a backer [**on Open Collective**](https://opencollective.com/core-js) or [**on Patreon**](https://www.patreon.com/zloirock) if you are interested in `core-js`.
---
<a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/0/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/0/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/1/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/1/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/2/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/2/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/3/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/3/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/4/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/4/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/5/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/5/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/6/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/6/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/7/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/7/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/8/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/8/avatar.svg"></a><a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/9/website" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/sponsor/9/avatar.svg"></a>
---
<a href=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js#backers" target="_blank"><img src=https://download.csdn.net/download/m0_61505785/"https://opencollective.com/core-js/backers.svg?width=890"></a>
---
**It's d
ocumentation for obsolete `core-js@2`. If you looking d
ocumentation for actual `core-js` version, please, check [this branch](https://github.com/zloirock/core-js/tree/master).**
Modular standard library for JavaS
cript. Includes polyfills for [ECMAS
cript 5](#ecmas
cript-5), [ECMAS
cript 6](#ecmas
cript-6): [promises](#ecmas
cript-6-promise), [symbols](#ecmas
cript-6-symbol), [collections](#ecmas
cript-6-collections), iterators, [typed arrays](#ecmas
cript-6-typed-arrays), [ECMAS
cript 7+ proposals](#ecmas
cript-7-proposals), [setImmediate](#setimmediate), etc. Some additio
nal features such as [dictionaries](#dict) or [extended partial application](#partial-application). You can require o
nly needed features or use it without global namespace pollution.
[*Example*](http://goo.gl/a2xexl):
```js
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
'*'.repeat(10); // => '**********'
Promise.resolve(32).then(x => console.log(x)); // => 32
setImmediate(x => console.log(x), 42); // => 42
```
[*Without global namespace pollution*](http://goo.gl/paOHb0):
```js
var core = require('core-js/library'); // With a modular system, otherwise use global `core`
core.Array.from(new core.Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
core.String.repeat('*', 10); // => '**********'
core.Promise.resolve(32).then(x => console.log(x)); // => 32
core.setImmediate(x => console.log(x), 42); // => 42
```
### Index
- [Usage](#usage)
- [Basic](#basic)
- [CommonJS](#commonjs)
- [Custom build](#custom-build-from-the-command-line)
- [Supported engines](#supported-engines)
- [Features](#features)
- [ECMAS
cript 5](#ecmas
cript-5)
- [ECMAS
cript 6](#ecmas
cript-6)
- [ECMAS
cript 6: Object](#ecmas
cript-6-object)
- [ECMAS
cript 6: Function](#ecmas
cript-6-function)
- [ECMAS
cript 6: Array](#ecmas
cript-6-array)
- [ECMAS
cript 6: String](#ecmas
cript-6-string)
- [ECMAS
cript 6: RegExp](#ecmas
cript-6-regexp)
- [ECMAS
cript 6: Number](#ecmas
cript-6-number)
- [ECMAS
cript 6: Math](#ecmas
cript-6-math)
- [ECMAS
cript 6: Date](#ecmas
cript-6-date)
- [ECMAS
cript 6: Promise](#ecmas
cript-6-promise)
- [ECMAS
cript 6: Symbol](#ecmas
cript-6-symbol)
- [ECMAS
cript 6: Collections](#ecmas
cript-6-collections)
- [ECMAS
cript 6: Typed Arrays](#ecmas
cript-6-typed-arrays)
- [ECMAS
cript 6: Reflect](#ecmas
cript-6-reflect)
- [ECMAS
cript 7+ proposals](#ecmas
cript-7-proposals)
- [stage 4 proposals](#stage-4-proposals)
- [stage 3 proposals](#stage-3-proposals)
- [stage 2 proposals](#stage-2-proposals)
- [stage 1 proposals](#stage-1-proposals)
- [stage 0 proposals](#stage-0-proposals)
- [pre-stage 0 proposals](#pre-stage-0-proposals)
- [Web standards](#web-standards)
- [setTimeout / setInterval](#settimeout--setinterval)
- [setImmediate](#setimmediate)
- [iterable DOM collections](#iterable-dom-collections)
- [Non-standard](#non-standard)
- [Object](#object)
- [Dict](#dict)
- [partial application](#partial-application)
- [Number Iterator](#number-iterator)
- [escaping strings](#escaping-strings)
- [delay](#delay)
- [helpers for iterators](#helpers-for-iterators)
- [Missing polyfills](#missing-polyfills)
- [Changelog](https://download.csdn.net/download/m0_61505785/CHANGELOG.md)
## Usage
### Basic
```
npm i core-js
bower install core.js
```
```js
// Default
require('core-js');
// Without global namespace pollution
var core = require('core-js/library');
// Shim o
nly
require('core-js/shim');
```
If you need complete build for browser, use builds from `core-js/client` path:
* [default](https://raw.githack.com/zloirock/core-js/v2.6.12/client/core.min.js): Includes all features, standard and non-standard.
* [as a library](https://raw.githack.com/zloirock/core-js/v2.6.12/client/library.min.js): Like "default", but does not pollute the global namespac
e (see [2nd example at the top](#core-js)).
* [shim only](https://raw.githack.com/zloirock/core-js/v2.6.12/client/shim.min.js): O
nly includes the standard methods.
Warning: if you use `core-js` with the extension of native objects, require all needed `core-js` modules at the beginning of entry point of your application, otherwise, co
nflicts may occur.
### Commo
nJS
You can require o
nly needed modules.
```js
require('core-js/fn/set');
require('core-js/fn/array/from');
require('core-js/fn/array/find-index');
Array.from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
[1, 2, NaN, 3, 4].findIndex(isNaN); // => 2
// or, w/o global namespace pollution:
var Set = require('core-js/library/fn/set');
var from = require('core-js/library/fn/array/from');
var findIndex = require('core-js/library/fn/array/find-index');
from(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]
findIndex([1, 2, NaN, 3, 4], isNaN); // => 2
```