Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

core-js

> 前端框架
Open source

Standard Library

25.5K stars0 likes4 views
WebsiteGitHub

About

Standard Library

Welcome to our new website, core-js.io, where our documentation is moving!

I highly recommend reading this: So, what's next?

Modular standard library for JavaScript. Includes polyfills for ECMAScript up to 2025: promises, symbols, collections, iterators, typed arrays, many other features, ECMAScript proposals, some cross-platform WHATWG / W3C features and proposals like URL. You can load only required features or use it without global namespace pollution.

core-js@3, babel and a look into the future

Raising funds

core-js isn't backed by a company, so the future of this project depends on you. Become a sponsor or a backer if you are interested in core-js: Open Collective, Patreon, Boosty, Bitcoin ( bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz ), Alipay.




Example of usage:

javascript
import 'core-js/actual';

Promise.try(() => 42).then(it => console.log(it)); // => 42

Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5]

[1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2]

Iterator.concat([1, 2], function * (i) { while (true) yield i++; }(3))
  .drop(1).take(5)
  .filter(it => it % 2)
  .map(it => it ** 2)
  .toArray(); // => [9, 25]

structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])

You can load only required features:

…

Or use it without global namespace pollution:

…

Index

  • Usage
    • Installation
    • postinstall message
    • CommonJS API
    • Babel
      • @babel/polyfill
      • @babel/preset-env
      • @babel/runtime
    • swc
    • Configurable level of aggressiveness
    • Custom build
  • Supported engines and compatibility data
  • Features
    • ECMAScript
      • ECMAScript: Object
      • ECMAScript: Function
      • ECMAScript: Error
      • ECMAScript: Array
      • ECMAScript: Iterator
      • ECMAScript: String and RegExp
      • ECMAScript: Number
      • ECMAScript: Math
      • ECMAScript: Date
      • ECMAScript: Promise
      • ECMAScript: Symbol
      • ECMAScript: Collections
      • ECMAScript: Explicit Resource Management
      • ECMAScript: Typed Arrays
      • ECMAScript: Reflect
      • ECMAScript: JSON
      • ECMAScript: globalThis
    • ECMAScript proposals
      • Finished proposals
        • globalThis
        • Relative indexing method
        • Array.prototype.includes
        • Array.prototype.flat / Array.prototype.flatMap
        • Array find from last
        • Change Array by copy
        • Array grouping
        • Array.fromAsync
        • ArrayBuffer.prototype.transfer and friends
        • Uint8Array to / from base64 and hex
        • Error.isError
        • Explicit Resource Management
        • Float16 methods
        • Iterator helpers
        • Iterator sequencing
        • Joint iteration
        • Object.values / Object.entries
        • Object.fromEntries
        • Object.getOwnPropertyDescriptors
        • Accessible Object.prototype.hasOwnProperty
        • String padding
        • String.prototype.matchAll
        • String.prototype.replaceAll
        • String.prototype.trimStart / String.prototype.trimEnd
        • RegExp s (dotAll) flag
        • RegExp named capture groups
        • RegExp escaping
        • Promise.allSettled
        • Promise.any
        • Promise.prototype.finally
        • Promise.try
        • Promise.withResolvers
        • Symbol.asyncIterator for asynchronous iteration
        • Symbol.prototype.description
        • JSON.parse source text access
        • Well-formed JSON.stringify
        • Well-formed unicode strings
        • New Set methods
        • Map upsert
        • Math.sumPrecise
      • Stage 3 proposals
        • Iterator chunking
        • Iterator includes
        • Iterator join
        • Await dictionary
      • Stage 2.7 proposals
        • Symbol.metadata for decorators metadata proposal
      • Stage 2 proposals
        • AsyncIterator helpers
        • Iterator.range
        • Array.isTemplateObject
        • Number.prototype.clamp
        • String.dedent
        • Symbol predicates
        • Symbol.customMatcher for extractors
      • Stage 1 proposals
        • Observable
        • New collections methods
        • .of and .from methods on collection constructors
        • compositeKey and compositeSymbol
        • Array filtering
        • Array deduplication
        • DataView get / set Uint8Clamped methods
        • Number.fromString
        • String.cooked
        • String.prototype.codePoints
        • Symbol.customMatcher for pattern matching
      • Stage 0 proposals
        • Function.prototype.demethodize
        • Function.{ isCallable, isConstructor }
      • Pre-stage 0 proposals
        • Reflect metadata
    • Web standards
      • self
      • structuredClone
      • Base64 utility methods
      • setTimeout and setInterval
      • setImmediate
      • queueMicrotask
      • URL and URLSearchParams
      • DOMException
      • iterable DOM collections
    • Iteration helpers
  • Missing polyfills
  • Contributing
  • Security policy
  • Changelog

Usage⬆

Installation:⬆

bash
// global version
npm install --save [email protected]
// version without global namespace pollution
npm install --save [email protected]
// bundled global version
npm install --save [email protected]

postinstall message⬆

The core-js project needs your help, so the package shows a message about it after installation. If it causes problems for you, you can disable it:

bash
ADBLOCK=true npm install
// or
DISABLE_OPENCOLLECTIVE=true npm install
// or
npm install --loglevel silent

CommonJS API⬆

You can import only-required-for-you polyfills, like in the examples at the top of README.md. Available CommonJS entry points for all polyfilled methods / constructors and namespaces. Just some examples:

…

[!TIP] The usage of the /actual/ namespace is recommended since it includes all actual JavaScript features and does not include unstable early-stage proposals that are available mainly for experiments.

[!WARNING]

  • The modules path is an internal API, does not inject all required dependencies and can be changed in minor or patch releases. Use it only for a custom build and/or if you know what are you doing.
  • If you use core-js with the extension of native objects, recommended to load all core-js modules at the top of the entry point of your application, otherwise, you can have conflicts.
    • For example, Google Maps use their own Symbol.iterator, conflicting with Array.from, URLSearchParams and / or something else from core-js, see related issues.
    • Such conflicts are also resolvable by discovering and manually adding each conflicting entry from core-js.
  • core-js is extremely modular and uses a lot of very tiny modules, because of that for usage in browsers bundle up core-js instead of a usage loader for each file, otherwise, you will have hundreds of requests.

CommonJS and prototype methods without global namespace pollution⬆

In the pure version, we can't pollute prototypes of native constructors. Because of that, prototype methods transformed into static methods like in examples above. But with transpi

Issues· 45 open

View all issuesOpen on GitHub
  • #1559

    邀请 core-js 加入 GithubStarMate,让更多人发现你的作品

    Updated Sep 30, 2026
  • #1179

    So, what's next?

    discussionUpdated Sep 25, 2026
  • #1556

    npm warn allow-scripts: postinstall message triggers this warning on every npm install

    Updated Sep 18, 2026
  • #1550

    Support ReadableStream async iteration

    Updated Jul 11, 2026
  • #1530

    Guidance on using core-js with modern toolchains (Vite 8 + OXC, no Babel/SWC)

    Updated Jun 9, 2026
  • #365

    Temporal implementation in core-js

    enhancementeshelp wantedUpdated Apr 2, 2026
  • #1011

    `URLPattern`

    enhancementweb standardshelp wantedUpdated Mar 20, 2026
  • #1527

    Reuse native methods in array internal modules when possible

    Updated Mar 19, 2026
  • #388

    Reduce minimalistic bundles size

    enhancementUpdated Mar 19, 2026
  • #1523

    requestAnimationFrame polyfill

    enhancementweb standardshelp wantedUpdated Mar 19, 2026

> Tags

JavaScriptecmascript-proposalses2015es6es7

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架