
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 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.
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:
import 'core-js/actual/promise';
import 'core-js/actual/set';
import 'core-js/actual/iterator';
import 'core-js/actual/array/from';
import 'core-js/actual/array/flat-map';
import 'core-js/actual/structured-clone';
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])
Or use it without global namespace pollution:
import Promise from 'core-js-pure/actual/promise';
import Set from 'core-js-pure/actual/set';
import Iterator from 'core-js-pure/actual/iterator';
import from from 'core-js-pure/actual/array/from';
import flatMap from 'core-js-pure/actual/array/flat-map';
import structuredClone from 'core-js-pure/actual/structured-clone';
Promise.try(() => 42).then(it => console.log(it)); // => 42
from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5]
flatMap([1, 2], 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])
postinstall messageglobalThisArray.prototype.includesArray.prototype.flat / Array.prototype.flatMapArray find from lastArray by copyArray groupingArray.fromAsyncArrayBuffer.prototype.transfer and friendsUint8Array to / from base64 and hexError.isErrorFloat16 methodsIterator helpersIterator sequencingObject.values / Object.entriesObject.fromEntriesObject.getOwnPropertyDescriptorsObject.prototype.hasOwnPropertyString paddingString.prototype.matchAllString.prototype.replaceAllString.prototype.trimStart / String.prototype.trimEndRegExp s (dotAll) flagRegExp named capture groupsRegExp escapingPromise.allSettledPromise.anyPromise.prototype.finallyPromise.tryPromise.withResolversSymbol.asyncIterator for asynchronous iterationSymbol.prototype.descriptionJSON.parse source text accessJSON.stringifySet methodsMap upsertMath.sumPreciseSymbol.metadata for decorators metadata proposalIterator chunkingAsyncIterator helpersIterator.rangeArray.isTemplateObjectNumber.prototype.clampString.dedentSymbol predicatesSymbol.customMatcher for extractorsObservable.of and .from methods on collection constructorscompositeKey and compositeSymbolArray filteringArray deduplicationDataView get / set Uint8Clamped methodsNumber.fromStringString.cookedString.prototype.codePointsSymbol.customMatcher for pattern matchingFunction.prototype.demethodizeFunction.{ isCallable, isConstructor }Reflect metadata// global version
npm install --save core-js@3.49.0
// version without global namespace pollution
npm install --save core-js-pure@3.49.0
// bundled global version
npm install --save core-js-bundle@3.49.0
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:
ADBLOCK=true npm install
// or
DISABLE_OPENCOLLECTIVE=true npm install
// or
npm install --loglevel silent
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:
``ts
// polyfill allcore-js` features, including early-stage proposals:
import "core-js";
// or:
import "core-js/full";
// polyfill all actual features - stable ES, web standards and stage 3 ES proposals:
import "core-js/actual";
// polyfill only stable features - ES and web standards:
import "core-js/stable";
// polyfill only stable ES features:
import "core-js/es";
// if you want to polyfill Set:
// all Set-related features, with ea
$ claude mcp add core-js \
-- python -m otcore.mcp_server <graph>