Skip to main content
Finished (Stage 4) proposals are already part of the ECMAScript standard and are available in core-js/stable and core-js/es namespaces. However, core-js also provides dedicated proposal entry points so you can load only features from a specific proposal.
// Load a finished proposal directly
import 'core-js/proposals/iterator-helpers';
import 'core-js/proposals/set-methods';
Finished proposals are polyfilled in older environments just like any other ES feature. Use the /proposals/ path when you want to be explicit about which proposal you depend on.

Array

Import: core-js/proposals/relative-indexing-method
[1, 2, 3].at(0);  // => 1
[1, 2, 3].at(-1); // => 3
'abc'.at(-1);     // => 'c'
Import: core-js/proposals/array-includes
[1, 2, 3].includes(2);     // => true
[1, 2, NaN].includes(NaN); // => true
Import: core-js/proposals/array-flat-map
[1, [2, [3]]].flat();     // => [1, 2, [3]]
[1, [2, [3]]].flat(Infinity); // => [1, 2, 3]
[1, 2, 3].flatMap(it => [it, it]); // => [1, 1, 2, 2, 3, 3]
Import: core-js/proposals/array-find-from-last
[1, 2, 3, 4].findLast(it => it % 2);      // => 3
[1, 2, 3, 4].findLastIndex(it => it % 2); // => 2
Import: core-js/proposals/change-array-by-copy-stage-4
const arr = [1, 2, 3];
arr.toReversed();       // => [3, 2, 1]  (arr unchanged)
arr.toSorted();         // => [1, 2, 3]
arr.toSpliced(1, 1, 4); // => [1, 4, 3]
arr.with(1, 42);        // => [1, 42, 3]
Import: core-js/proposals/array-grouping-v2
Object.groupBy([1, 2, 3, 4, 5], it => it % 2 ? 'odd' : 'even');
// => { odd: [1, 3, 5], even: [2, 4] }

Map.groupBy([1, 2, 3, 4, 5], it => it % 2 ? 'odd' : 'even');
// => Map { 'odd' => [1, 3, 5], 'even' => [2, 4] }
Import: core-js/proposals/array-from-async
await Array.fromAsync(new Set([1, 2, 3])); // => [1, 2, 3]

async function * asyncGenerator() {
  yield 1; yield 2; yield 3;
}
await Array.fromAsync(asyncGenerator()); // => [1, 2, 3]

ArrayBuffer

Import: core-js/proposals/array-buffer-transfer
const buffer = Int8Array.of(1, 2, 3, 4).buffer;
const newBuffer = buffer.transfer(2);
console.log(buffer.detached);       // => true
console.log(newBuffer.byteLength);  // => 2
Import: core-js/proposals/array-buffer-base64
const arr = new Uint8Array([72, 101, 108, 108, 111]);
arr.toBase64();  // => 'SGVsbG8='
arr.toHex();     // => '48656c6c6f'

Uint8Array.fromBase64('SGVsbG8='); // => Uint8Array([72, 101, 108, 108, 111])
Uint8Array.fromHex('48656c6c6f'); // => Uint8Array([72, 101, 108, 108, 111])

Error

Import: core-js/proposals/is-error
Error.isError(new Error());          // => true
Error.isError(new TypeError());      // => true
Error.isError({ message: 'error' }); // => false
Import: core-js/proposals/explicit-resource-management
import 'core-js/proposals/explicit-resource-management';

class Resource {
  [Symbol.dispose]() { console.log('disposed'); }
}
// Use with `using` keyword (requires transpiler support)

Float16

Import: core-js/proposals/float16array
new Float16Array([1, 1.5, 2]);    // => Float16Array [1, 1.5, 2]
Math.f16round(1.337);             // => 1.3369140625
const view = new DataView(new ArrayBuffer(4));
view.setFloat16(0, 1.5);
view.getFloat16(0);               // => 1.5

Iterator

Import: core-js/proposals/iterator-helpers
import 'core-js/proposals/iterator-helpers';

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]
Import: core-js/proposals/iterator-sequencing
Iterator.concat([1, 2], [3, 4], [5, 6]).toArray(); // => [1, 2, 3, 4, 5, 6]

Object

Import: core-js/proposals/object-values-entries
Object.values({ a: 1, b: 2 });  // => [1, 2]
Object.entries({ a: 1, b: 2 }); // => [['a', 1], ['b', 2]]
Import: core-js/proposals/object-from-entries
Object.fromEntries([['a', 1], ['b', 2]]); // => { a: 1, b: 2 }
Object.fromEntries(new Map([['a', 1]]));  // => { a: 1 }
Import: core-js/proposals/object-getownpropertydescriptors
const source = { get foo() { return 1; } };
Object.defineProperties({}, Object.getOwnPropertyDescriptors(source));
Import: core-js/proposals/accessible-object-hasownproperty
Object.hasOwn({ foo: 42 }, 'foo'); // => true

String

Import: core-js/proposals/string-padding
'42'.padStart(5, '0'); // => '00042'
'hi'.padEnd(5, '!');   // => 'hi!!!'
Import: core-js/proposals/string-match-all
for (const [full, group] of 'test1test2'.matchAll(/test(\d)/g)) {
  console.log(full, group); // 'test1' '1', 'test2' '2'
}
Import: core-js/proposals/string-replace-all-stage-4
'aabbcc'.replaceAll('b', 'x'); // => 'aaxxcc'
Import: core-js/proposals/string-left-right-trim
'  hello  '.trimStart(); // => 'hello  '
'  hello  '.trimEnd();   // => '  hello'

Promise

Import: core-js/proposals/promise-all-settled
Promise.allSettled([
  Promise.resolve(1),
  Promise.reject(2),
]); // => [{ status: 'fulfilled', value: 1 }, { status: 'rejected', reason: 2 }]
Import: core-js/proposals/promise-any
await Promise.any([Promise.reject(1), Promise.resolve(2)]); // => 2
Import: core-js/proposals/promise-finally
fetch(url).then(process).catch(handleError).finally(cleanup);
Import: core-js/proposals/promise-try
Promise.try(() => 42).then(console.log);            // => 42
Promise.try(() => { throw new Error('oops'); }).catch(console.error);
Import: core-js/proposals/promise-with-resolvers
const { promise, resolve, reject } = Promise.withResolvers();
setTimeout(resolve, 1000, 'done');
await promise; // => 'done' after 1s

Symbol

Import: core-js/proposals/async-iterationEnables for await...of loops over async iterables.
async function * asyncGen() { yield 1; yield 2; }
for await (const val of asyncGen()) console.log(val); // => 1, 2
Import: core-js/proposals/symbol-description
Symbol('foo').description; // => 'foo'
Symbol().description;      // => undefined

Collections

Import: core-js/proposals/set-methods-v2
const a = new Set([1, 2, 3]);
const b = new Set([2, 3, 4]);

a.union(b);              // => Set {1, 2, 3, 4}
a.intersection(b);       // => Set {2, 3}
a.difference(b);         // => Set {1}
a.symmetricDifference(b);// => Set {1, 4}
a.isSubsetOf(b);         // => false
a.isSupersetOf(b);       // => false
a.isDisjointFrom(b);     // => false
Import: core-js/proposals/map-upsert-v4
const map = new Map([['a', 1]]);
map.getOrInsert('a', 0);                     // => 1 (key exists)
map.getOrInsert('b', 0);                     // => 0 (inserted)
map.getOrInsertComputed('c', key => key);    // => 'c'

Math

Import: core-js/proposals/math-sum
Math.sumPrecise([0.1, 0.2]);              // => 0.3
Math.sumPrecise([1e20, 0.1, -1e20]);      // => 0.1

Build docs developers (and LLMs) love