1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-core-js

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

logo

fundraising PRs welcome version core-js downloads core-js-pure downloads jsDelivr

Рекомендуем прочитать это: Итак, что дальше?


Модульная стандартная библиотека для JavaScript. Включает полифиллы для ECMAScript до 2024 года: промисов, символов, коллекций, итераторов, типизированных массивов, многие другие функции, предложений ECMAScript, некоторых кросс-платформенных WHATWG / W3C функций и предложений как URL. Вы можете загрузить только необходимые функции или использовать без загрязнения глобального пространства имен.

Если вы ищете документацию для устаревшей core-js@2, пожалуйста, проверьте этот ветвь.## core-js@3, babel и взгляд в будущее

Сбор средств

core-js не поддерживается компанией, поэтому будущее этого проекта зависит от вас. Если вас интересует core-js, станьте спонсором или поддержите проект: Open Collective, Patreon, Boosty, Bitcoin (bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz), Alipay.

------


Пример использования:

import 'core-js/actual';

Promise.resolve(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]

(function * (i) { while (true) yield i++; })(1)
  .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])

Можно загрузить только необходимые функции:

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.resolve(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]

(function * (i) { while (true) yield i++; })(1)
  .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])

Или использовать без загрязнения глобального пространства имен:

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.resolve(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.from(function * (i) { while (true) yield i++; }(1))
  .drop(1).take(5)
  .filter(it => it % 2)
  .map(it => it ** 2)
  .toArray(); // => [9, 25]
``````markdown
### Индекс
  - [Использование](#использование)
    - [Установка](#установка)
    - [Сообщение `postinstall`](#postinstall-сообщение)
    - [API CommonJS](#commonjs-api)
    - [Babel](#babel)
      - [`@babel/polyfill`](#babelpolyfill)
      - [`@babel/preset-env`](#babelpreset-env)
      - [`@babel/runtime`](#babelruntime)
    - [swc](#swc)
    - [Настройка уровня агрессивности](#настройка-уровня-агрессивности)
    - [Пользовательская сборка](#пользовательская-сборка)
  - [Поддерживаемые движки и данные совместимости](#поддерживаемые-движки-и-данные-совместимости)
  - [Особенности](#особенности)
    - [ECMAScript](#ecmascript)
      - [ECMAScript: Объект](#ecmascript-объект)
      - [ECMAScript: Функция](#ecmascript-функция)
      - [ECMAScript: Ошибка](#ecmascript-ошибка)
      - [ECMAScript: Массив](#ecmascript-массив)
      - [ECMAScript: Итератор](#ecmascript-итератор)
      - [ECMAScript: Строка и регулярное выражение](#ecmascript-строка-и-регулярное-выражение)
      - [ECMAScript: Число](#ecmascript-число)
      - [ECMAScript: Math](#ecmascript-math)
      - [ECMAScript: Дата](#ecmascript-дата)
      - [ECMAScript: Промис](#ecmascript-промис)
      - [ECMAScript: Символ](#ecmascript-символ)
      - [ECMAScript: Коллекции](#ecmascript-коллекции)
      - [ECMAScript: Типизированные массивы](#ecmascript-типизированные-массивы)
      - [ECMAScript: Reflect](#ecmascript-reflect)
      - [ECMAScript: JSON](#ecmascript-json)
      - [ECMAScript: globalThis](#ecmascript-globalthis)
    - [Предложения ECMAScript](#ecmascript-предложения)
      - [Завершенные предложения](#завершенные-предложения)
        - [`globalThis`](#globalthis)
        - [Метод относительного индексирования](#метод-относительного-индексирования)
        - [`Array.prototype.includes`](#arrayprototypeincludes)
```       - [`Array.prototype.flat` / `Array.prototype.flatMap`](#arrayprototypeflat--arrayprototypeflatmap)
        - [Поиск в массиве с конца](#поиск-в-массиве-с-конца)
        - [Изменение массива по копии](#изменение-массива-по-копии)
        - [Группировка массива](#группировка-массива)
        - [`ArrayBuffer.prototype.transfer` и друзья](#arraybufferprototypetransfer-и-друзья)
        - [Методы `Float16`](#float16-методы)
        - [Помощники итератора](#помощники-итератора)
        - [`Object.values` / `Object.entries`](#objectvalues--objectentries)
        - [`Object.fromEntries`](#objectfromentries)
        - [`Object.getOwnPropertyDescriptors`](#objectgetownpropertydescriptors)
        - [Доступный `Object.prototype.hasOwnProperty`](#доступный-objectprototypehasownproperty)
        - [Заполнение строки](#заполнение-строки)
        - [`String.prototype.matchAll`](#stringmatchall)
        - [`String.prototype.replaceAll`](#stringreplaceall)
        - [`String.prototype.trimStart` / `String.prototype.trimEnd`](#stringprototypetrimstart--stringprototypetrimend)
        - [`RegExp` `s` (`dotAll`) флаг](#regexp-s-dotall-flag)
        - [`RegExp` именованные захваченные группы](#regexp-named-capture-groups)
        - [`RegExp` экранирование](#regexp-escaping)
        - [`Promise.allSettled`](#promiseallsettled)
        - [`Promise.any`](#promiseany)
        - [`Promise.prototype.finally`](#promiseprototypefinally)
        - [`Promise.try`](#promisetry)
        - [`Promise.withResolvers`](#promisewithresolvers)
        - [`Symbol.asyncIterator` для асинхронного итерирования](#symbolasynciterator-для-асинхронного-итерирования)
        - [`Symbol.prototype.description`](#symbolprototypedescription)
        - [Корректное `JSON.stringify`](#well-formed-jsonstringify)
        - [Корректные unicode строки](#well-formed-unicode-strings)
        - [Новые методы `Set`](#new-set-methods)
      - [Предложения Stage 3](#stage-3-proposals)
        - [`Array.fromAsync`](#arrayfromasync)
        - [`JSON.parse` доступ к исходному тексту](#jsonparse-source-text-access)       - [`Uint8Array` к / из base64 и hex](#uint8array-to--from-base64-and-hex)
        - [Ясное управление ресурсами](#explicit-resource-management)
        - [`Math.sumPrecise`](#mathsumprecise)
        - [`Symbol.metadata` для предложений декораторов метаданных](#symbolmetadata-for-decorators-metadata-proposal)
        - [`Error.isError`](#erroriserror)
      - [Предложения Stage 2. 7](#stage-27-proposals)
        - [`Iterator` последовательность](#iterator-sequencing)
        - [`Map` upsert](#map-upsert)
      - [Предложения Stage 2](#stage-2-proposals)
        - [`AsyncIterator` помощники](#asynciterator-helpers)
        - [`Iterator.range`](#iteratorrange)
        - [`Array.isTemplateObject`](#arrayistemplateobject)
        - [`String.dedent`](#stringdedent)
        - [`Symbol` предикаты](#symbol-predicates)
        - [`Symbol.customMatcher` для извлечений](#symbolcustommatcher-for-extractors)
      - [Предложения Stage 1](#stage-1-proposals)
        - [`Observable`](#observable)
        - [Новые методы коллекций](#new-collections-methods)
        - [`.of` и `.from` методы на конструкторах коллекций](#of-and-from-methods-on-collection-constructors)
        - [`compositeKey` и `compositeSymbol`](#compositekey-and-compositesymbol)
      - [Фильтрация массива](#фильтрация-массива)
        - [Удаление дубликатов массива](#удаление-дубликатов-массива)
        - [Методы `get` и `set` для `Uint8Clamped` в `DataView`](#методы-get-и-set-для-uint8clamped-в-dataview)
        - [Метод `Math.clamp`](#mathclamp)
        - [Метод `Number.fromString`](#numberfromstring)
        - [Обработанные строки](#обработанные-строки)
        - [Метод `String.prototype.codePoints`](#stringprototypecodepoints)
        - [Символ `Symbol.customMatcher` для соответствия шаблону](#символ-symbolcustommatcher-для-соответствия-шаблону)
      - [Предложения на стадии 0](#предложения-на-стадии-0)
        - [Метод `Function.prototype.demethodize`](#functionprototypedemethodize)
        - [Свойства `Function`](#function)isCallable` и `Function.isConstructor`](#function-iscallable-и-function-isconstructor-)
      - [Предложения до стадии 0](#предложения-до-стадии-0)
        - [Метаданные `Reflect`](#reflect-metadata)
    - [Веб-стандарты](#веб-стандарты)
      - [Объект `self`](#self)
      - [Метод `structuredClone`](#structuredclone)
      - [Утилитные методы Base64](#утилитные-методы-base64)
      - [Методы `setTimeout` и `setInterval`](#settimeout-и-setinterval)
      - [Метод `setImmediate`](#setimmediate)
      - [Метод `queueMicrotask`](#queuemicrotask)
      - [Классы `URL` и `URLSearchParams`](#url-и-urlsearchparams)
      - [Класс `DOMException`](#domexception)
      - [Итерируемые коллекции DOM](#итерируемые-коллекции-dom)
    - [Помощники итерации](#помощники-итерации)
  - [Отсутствующие полифиллы](#отсутствующие-полифиллы)
  - [Участие](./CONTRIBUTING.md)
  - [Политика безопасности](https://github.com/zloirock/core-js/blob/master/SECURITY.md)
  - [Журнал изменений](./CHANGELOG.md)

## Использование[](#index)

### Установка:[](#index)
```sh
// глобальная версия
npm install --save core-js@3.42.0
// версия без загрязнения глобального пространства имен
npm install --save core-js-pure@3.42.0
// упакованная глобальная версия
npm install --save core-js-bundle@3.42.0
```Или вы можете использовать `core-js` [из CDN](https://www.jsdelivr.com/package/npm/core-js-bundle).

### Сообщение `postinstall`[](#index)
Проект `core-js` нуждается в вашей помощи, поэтому пакет показывает сообщение об этом после установки. Если это вызывает проблемы, вы можете отключить его:
```sh
ADBLOCK=true npm install
// или
DISABLE_OPENCOLLECTIVE=true npm install
// или
npm install --loglevel silent

API CommonJS

Вы можете импортировать только те полифиллы, которые вам необходимы, как показано в примерах в верхней части README.md. Доступные точки входа CommonJS для всех полифиллов методов / конструкторов и пространств имен. Просто некоторые примеры:

// полифилл всех функций `core-js`, включая ранние стадии предложений:
import "core-js";
// или:
import "core-js/full";
// полифилл всех фактических функций - стабильных ES, веб-стандартов и предложений ES стадии 3:
import "core-js/actual";
// полифилл только стабильных функций - ES и веб-стандартов:
import "core-js/stable";
// полифилл только стабильных функций ES:
import "core-js/es";
```// если вы хотите полифилл `Set`:
// все функции, связанные с `Set`, включая ранние стадии предложений ES:
import "core-js/full/set";
// стабильные функции ES, необходимые для `Set`, функции из веб-стандартов и предложений ES стадии 3:
import "core-js/actual/set";
// стабильные функции ES, необходимые для `Set` и функции из веб-стандартов
// (итератор коллекций DOM в этом случае):
import "core-js/stable/set";
// только стабильные функции ES, необходимые для `Set`:
import "core-js/es/set";
// то же самое без загрязнения глобального пространства имен:
import Set from "core-js-pure/full/set";
import Set from "core-js-pure/actual/set";
import Set from "core-js-pure/stable/set";
import Set from "core-js-pure/es/set";// если вы хотите полифилл только необходимые методы:
import "core-js/full/set/intersection";
import "core-js/actual/array/find-last";
import "core-js/stable/queue-microtask";
import "core-js/es/array/from";

// полифилл предложения итераторов помощников:
import "core-js/proposals/iterator-helpers";
// полифилл всех предложений стадии 2+:
import "core-js/stage/2";
```> [!TIP]
> Использование пространства имен `/actual/` рекомендуется, так как оно включает все актуальные функции JavaScript и не включает нестабильные ранние стадии предложений, доступные в основном для экспериментов.
> ```> [!WARNING]
> - Путь `modules` является внутренним API, не внедряет все необходимые зависимости и может быть изменен в минорных или патч-релизах. Используйте его только для кастомного сбора и/или если вы знаете, что делаете.
> - Если вы используете `core-js` с расширением встроенных объектов, рекомендуется загружать все модули `core-js` в начале точки входа вашего приложения, в противном случае вы можете столкнуться с конфликтами.
>   - Например, Google Maps используют собственный `Symbol.iterator`, конфликтующий с `Array.from`, `URLSearchParams` и/или чем-то еще из `core-js`, см. [связанные проблемы](https://github.com/zloirock/core-js/search?q=Google+Maps&type=Issues).
>   - Такие конфликты также разрешимы путем обнаружения и ручного добавления каждого конфликтного элемента из `core-js`.
> - `core-js` является крайне модульным и использует множество очень маленьких модулей, поэтому для использования в браузерах рекомендуется собрать `core-js` вместо использования загрузчика для каждого файла, иначе у вас будет сотни запросов.#### CommonJS и методы прототипа без загрязнения глобального пространства имен[⬆](#index)
В версии `pure` мы не можем загрязнять прототипы встроенных конструкторов. Из-за этого методы прототипа преобразуются в статические методы, как показано в примерах выше. Но с транспиляторами мы можем использовать еще один трюк - [оператор bind и виртуальные методы](https://github.com/tc39/proposal-bind-operator). Для этого доступны виртуальные точки входа `/virtual/`. Пример:
```ts
import fill from 'core-js-pure/actual/array/virtual/fill';
import findIndex from 'core-js-pure/actual/array/virtual/find-index';

Array(10)::fill(0).map((a, b) => b * b)::findIndex(it => it && !(it % 8)); // => 4

[!WARNING] Оператор bind является ранней стадией предложения ECMAScript, и использование этого синтаксиса может быть опасным.

Babel

core-js интегрирован с babel и является основой для функций полифилла в babel:

@babel/polyfill@babel/polyfill является просто импортом стабильных функций core-js и regenerator-runtime для генераторов и асинхронных функций, поэтому загрузка @babel/polyfill означает загрузку глобальной версии core-js без предложений ES. Теперь это устарело в пользу отдельного включения необходимых частей core-js и regenerator-runtime, и для обратной совместимости @babel/polyfill всё ещё основан на core-js@2.

Как полный аналог @babel/polyfill, вы можете использовать следующее:

import 'core-js/stable';
import 'regenerator-runtime/runtime';
```#### `@babel/preset-env`[](#index)

[`@babel/preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) имеет опцию `useBuiltIns`, которая оптимизирует использование глобальной версии `core-js`. С опцией `useBuiltIns` вы также должны установить опцию `corejs` на используемую версию `core-js`, например `corejs: '3.42'`.

> [!ВАЖНО]
> Рекомендуется указывать используемую мажорную версию `core-js`, например `corejs: '3.42'`, вместо `corejs: 3`, так как с `corejs: 3` не будут внедрены модули, добавленные в мажорные версии `core-js`.

---- `useBuiltIns: 'entry'` заменяет импорты `core-js` на импорт только необходимых для целевой среды модулей. Так, например,
```js
import 'core-js/stable';

с целевой средой chrome 71 будет заменено на:

import 'core-js/modules/es.array.unscopables.flat';
import 'core-js/modules/es.array.unscopables.flat-map';
import 'core-js/modules/es.object.from-entries';
import 'core-js/modules/web.immediate';

Это работает для всех точек входа глобальной версии core-js и их комбинаций, например для

import 'core-js/es';
import 'core-js/proposals/set-methods';
import 'core-js/full/set/map';

с целевой средой chrome 71 вы получите в результате:

import 'core-js/modules/es.array.unscopables.flat';
import 'core-js/modules/es.array.unscopables.flat-map';
import 'core-js/modules/es.object.from-entries';
import 'core-js/modules/esnext.set.difference';
import 'core-js/modules/esnext.set.intersection';
import 'core-js/modules/esnext.set.is-disjoint-from';
import 'core-js/modules/esnext.set.is-subset-of';
import 'core-js/modules/esnext.set.is-superset-of';
import 'core-js/modules/esnext.set.map';
import 'core-js/modules/esnext.set.symmetric-difference';
import 'core-js/modules/esnext.set.union';
  • useBuiltIns: 'usage' добавляет в начало каждого файла импорт полифиллов для функций, используемых в этом файле и не поддерживаемых целевыми окружениями, поэтому для:
// первый файл:
let set = new Set([1, 2, 3]);
// второй файл:
let array = Array.of(1, 2, 3);

если цель включает старое окружение, такое как IE 11, у нас будет что-то вроде:

// первый файл:
import 'core-js/modules/es.array.iterator';
import 'core-js/modules/es.object.to-string';
import 'core-js/modules/es.set';
```var set = new Set([1, 2, 3]);
```js
```js
// второй файл:
import 'core-js/modules/es.array.of';
```var array = Array.of(1, 2, 3);

По умолчанию, @babel/preset-env с опцией useBuiltIns: 'usage' полифиллит только стабильные функции, но вы можете включить полифиллинг предложений с помощью опции proposals, как corejs: { version: '3.42', proposals: true }.

[!ВАЖНО] В случае использования useBuiltIns: 'usage', вы не должны добавлять импорты core-js самостоятельно, они будут добавлены автоматически.

@babel/runtime

@babel/runtime с опцией corejs: 3 упрощает работу с core-js-pure. Он автоматически заменяет использование современных функций из стандартной библиотеки JavaScript на импорты из версии core-js без загрязнения глобального пространства имен, поэтому вместо:

import from from 'core-js-pure/stable/array/from';
import flat from 'core-js-pure/stable/array/flat';
import Set from 'core-js-pure/stable/set';
import Promise from 'core-js-pure/stable/promise';

from(new Set([1, 2, 3, 2, 1]));
flat([1, [2, 3], [4, [5]]], 2);
Promise.resolve(32).then(x => console.log(x));

вы можете написать просто:

Array.from(new Set([1, 2, 3, 2, 1]));
[1, [2, 3], [4, [5]]].flat(2);
Promise.resolve(32).then(x => console.log(x));

По умолчанию, @babel/runtime полифиллит только стабильные функции, но, как и в @babel/preset-env, вы можете включить полифиллинг предложений с помощью опции proposals, как corejs: { version: 3, proposals: true }.

[!ВНИМАНИЕ] Если вы используете @babel/preset-env и @babel/runtime вместе, используйте опцию corejs только в одном месте, так как это дублирующая функциональность и может вызвать конфликты.### swc

Быстрый транспилятор JavaScript swc содержит интеграцию с core-js, что оптимизирует работу с глобальной версией core-js. Как и @babel/preset-env, у него есть 2 режима: usage и entry, но режим usage всё ещё работает не так хорошо, как в babel. Пример конфигурации в .swcrc:

{
  "env": {
    "targets": "> 0.25%, not dead",
    "mode": "entry",
    "coreJs": "3.42"
  }
}

Настройка уровня агрессивности

По умолчанию, core-js устанавливает полифиллы только тогда, когда они требуются. Это означает, что core-js проверяет, доступна ли функция и работает ли она правильно или нет, и если у неё нет проблем, core-js использует нативную реализацию. Но иногда обнаружение функций core-js может быть слишком строгим для вашего случая. Например, конструктор Promise требует поддержки отслеживания необработанных отказов и @@species.

Иногда мы можем столкнуться с обратной проблемой — известно сломанным окружением с проблемами, не охваченными обнаружением функций core-js.

Для этих случаев можно переопределить это поведение для определенных полифиллов:

const configurator = require('core-js/configurator');

configurator({
  useNative: ['Promise'],                                 // полифиллы будут использоваться только в том случае, если нативные функции полностью недоступны
  usePolyfill: ['Array.from', 'String.prototype.padEnd'], // полифиллы будут использоваться всегда
  useFeatureDetection: ['Map', 'Set'],                    // стандартное поведение
});
```require('core-js/actual');

Это не работает со всеми функциями. Также, если вы измените стандартное поведение, даже внутренние компоненты core-js могут работать некорректно.

Пользовательская сборка

Для некоторых случаев может быть полезно исключить некоторые функции core-js или сгенерировать полифилл для целевых движков. Вы можете использовать пакет core-js-builder для этого.

Поддерживаемые движки и данные совместимости

core-js пытается поддерживать все возможные JS движки и окружения с поддержкой ES3. Некоторые функции имеют более высокий порог — например, некоторые доступоры могут корректно работать только с ES5, а промисы требуют способности установки микротаска или таска, и т.д.

Однако, у меня нет возможности тестировать core-js абсолютно везде — например, тестирование в IE7 и некоторых других древних версиях было прекращено. Список определенно поддерживаемых движков вы можете увидеть в таблице совместимости по ссылке ниже. Напишите, если у вас есть проблемы или вопросы по поддержке любого движка.Проект core-js предоставляет (как пакет core-js-compat) все необходимые данные о необходимости модулей core-js, точек входа и инструментов для работы с ними — это полезно для интеграции с инструментами, такими как babel или swc. Если вы хотите помочь, вы можете взглянуть на соответствующий раздел документа CONTRIBUTING.md. Визуализация данных совместимости и браузерный тестер доступны здесь, пример:compat-table## Возможности: CommonJS точки входа:

core-js(-pure)

ECMAScript

CommonJS точки входа:

core-js(-pure)/es

ECMAScript: Объект

Модули [es. object. assign](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. assign.js), [es. object. create](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. create.js), [es. object. define-getter](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. define-getter.js), [es. object. define-property](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. define-property.js), [es. object. define-properties](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. define-properties.js), [es. object. define-setter](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. define-setter.js), [es. object. entries](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. entries.js), [es. object. freeze](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. freeze.js), [es. object. from-entries](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. from-entries.js), [es. object. get-own-property-descriptor](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. get-own-property-descriptor.js), [es. object. get-own-property-descriptors](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. get-own-property-descriptors.js), [es. object. get-own-property-names](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. get-own-property-names.js), [es. object. get-prototype-of](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. get-prototype-of.js), [es. object. group-by](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. group-by.js), [es. object. has-own](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. has-own.js), [es. object. is](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is.js),com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is. js), [es. object. is-extensible](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is-extensible. js), [es. object. is-frozen](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is-frozen. js),[es. object. is-frozen](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is-frozen. js), [es. object. is-sealed](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. is-sealed. js), [es. object. keys](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. keys. js), [es. object. lookup-setter](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. lookup-setter. js), [es. object. lookup-getter](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. lookup-getter. js), [es. object. prevent-extensions](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. prevent-extensions. js), [es. object. proto](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. proto. js), [es. object. to-string](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. to-string. js), [es. object. seal](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. seal. js), [es. object. set-prototype-of](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. set-prototype-of. js), [es. object. values](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/es. object. values. js). ts class Object { toString(): string; // ES2015+ исправление: поддержка @@toStringTag __defineGetter__(property: PropertyKey, getter: Function): void; __defineSetter__(property: PropertyKey, setter: Function): void; __lookupGetter__(property: PropertyKey): Function | void; __lookupSetter__(property: PropertyKey): Function | void; __proto__: Object | null; // требуется способ установки прототипа - не поддерживается в IE10-, предназначен для современных движков, таких как Deno static assign(target: Object, ...typescript Object { static create(prototype: Object | null, properties? : { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor }): Object; static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object; static entries(object: Object): Array<[string, mixed]>; static freeze(object: any): any; static fromEntries(iterable: Iterable<[key, value]>): Object; static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void; static getOwnPropertyDescriptors(object: any): { [property: PropertyKey]: PropertyDescriptor }; static getOwnPropertyNames(object: any): Array; static getPrototypeOf(object: any): Object | null; static groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): { [key]: Array }; static hasOwn(object: object, key: PropertyKey): boolean; static is(value1: any, value2: any): boolean; static isExtensible(object: any): boolean; static isFrozen(object: any): boolean; static isSealed(object: any): boolean; static keys(object: any): Array; static preventExtensions(object: any): any; static seal(object: any): any; static setPrototypeOf(target: any, prototype: Object | null): any; // требуется proto - поддерживается в IE11+ static values(object: any): Array; }

[*CommonJS точки входа:*](#commonjs-api)

core-js(-pure)/es|стабильная|актуальная|полная/объект core-js(-pure)/es|стабильная|актуальная|полная/объект/присоединить core-js(-pure)/es|стабильная|актуальная|полная/объект/идентичность core-js(-pure)/es|стабильная|актуальная|полная/объект/установить-прототип-класса core-js(-pure)/es|стабильная|актуальная|полная/объект/получить-прототип-класса core-js(-pure)/es|стабильная|актуальная|полная/объект/создать core-js(-pure)/es|стабильная|актуальная|полная/объект/определить-свойство core-js(-pure)/es|стабильная|актуальная|полная/объект/определить-свойства core-js(-pure)/es|стабильная|актуальная|полная/объект/получить-собственное-свойство-описание core-js(-pure)/es|стабильная|актуальная|полная/объект/получить-собственные-свойства-описания core-js(-pure)/es|стабильная|актуальная|полная/объект/группировать-по

 core-js(-pure)/es|стабильная|актуальная|полная/объект/ключи
 core-js(-pure)/es|стабильная|актуальная|полная/объект/значения
 core-js(-pure)/es|стабильная|актуальная|полная/объект/входы
 core-js(-pure)/es|стабильная|актуальная|полная/объект/получить-собственные-имена-свойств
 core-js(-pure)/es|стабильная|актуальная|полная/объект/заморозить
 core-js(-pure)/es|стабильная|актуальная|полная/объект/создать-из-входов
 core-js(-pure)/es|стабильная|актуальная|полная/объект/закрыть
 core-js(-pure)/es|стабильная|актуальная|полная/объект/предотвратить-расширение
 core-js/es|стабильная|актуальная|полная/объект/proto
 core-js(-pure)/es|стабильная|актуальная|полная/объект/является-замороженным
 core-js(-pure)/es|стабильная|актуальная|полная/объект/является-закрытым
 core-js(-pure)/es|стабильная|актуальная|полная/объект/является-расширяемым
 core-js/es|стабильная|актуальная|полная/объект/строка
 core-js(-pure)/es|стабильная|актуальная|полная/объект/определить-чтение
 core-js(-pure)/es|стабильная|актуальная|полная/объект/определить-запись
 core-js(-pure)/es|стабильная|актуальная|полная/объект/поиск-чтения
 core-js(-pure)/es|стабильная|актуальная|полная/объект/поиск-записи

Примеры:

let foo = { q: 1, w: 2 };
let bar = { e: 3, r: 4 };
let baz = { t: 5, y: 6 };
Object.assign(foo, bar, baz); // => foo = { q: 1, w: 2, e: 3, r: 4, t: 5, y: 6 }
```Object.is(NaN, NaN); // => true
Object.is(0, -0);    // => false
Object.is(42, 42);   // => true
Object.is(42, '42'); // => falsefunction Родитель() { /* пустое */ }
function Дитя() { /* пустое */ }
Object.setPrototypeOf(Дитя.prototype, Родитель.prototype);
new Дитя() instanceof Дитя;  // => true
new Дитя() instanceof Родитель; // => true

({
[Symbol.toStringTag]: 'Foo',
}).toString(); // => '[object Foo]'

Object.keys('qwe'); // => ['0', '1', '2']
Object.getPrototypeOf('qwe') === String.prototype; // => true

Object.values({ a: 1, b: 2, c: 3 });  // => [1, 2, 3]
Object.entries({ a: 1, b: 2, c: 3 }); // => [['a', 1], ['b', 2], ['c', 3]]

for (let [key, value] of Object.entries({ a: 1, b: 2, c: 3 })) {
console.log(key);   // => 'a', 'b', 'c'
console.log(value); // => 1, 2, 3
}

// Глубокое клонирование объекта с прототипом и дескрипторами:
let copy = Object.create(Object.getPrototypeOf(object), Object.getOwnPropertyDescriptors(object));
// Mixin:
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));

const map = new Map([['a', 1], ['b', 2]]);
Object.fromEntries(map); // => { a: 1, b: 2 }

class Unit {
constructor(id) {
  this.id = id;
}
toString() {
  return `unit${ this.id }`;
}
}

const units = new Set([new Unit(101), new Unit(102)]);

Object.fromEntries(units.entries()); // => { unit101: Unit { id: 101 }, unit102: Unit { id: 102 } }

Object.hasOwn({ foo: 42 }, 'foo'); // => true
Object.hasOwn({ foo: 42 }, 'bar'); // => false
Object.hasOwn({}, 'toString');     // => falseObject.groupBy([1, 2, 3, 4, 5], it => it % 2); // => { 1: [1, 3, 5], 0: [2, 4] }#### ECMAScript: Функция [⬆](#index)
Модули [`es.function.name`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.name.js), [`es.function.has-instance`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.has-instance.js). Только ES5: [`es.function.bind`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.function.bind.js).
```ts
class Function {
name: string;
bind(thisArg: any, ...args: Array<mixed>): Function;
@@hasInstance(value: any): boolean;
}

CommonJS точки входа:

core-js/es|stable|actual|full/функция
core-js/es|stable|actual|full/функция/имя
core-js/es|stable|actual|full/функция/has-instance
core-js(-pure)/es|stable|actual|full/функция/bind
core-js(-pure)/es|stable|actual|full/функция/virtual/bind

Пример:

(function foo() { /* пустое */ }).name; // => 'foo'
console.log.bind(console, 42)(43); // => 42 43
```#### ECMAScript: Ошибка[⬆](#index)
Модули [`es.aggregate-error`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.aggregate-error.js), [`es.aggregate-error.cause`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.aggregate-error.cause.js), [`es.error.cause`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.error.cause.js), [`es.error.to-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.error.to-string.js).
```ts
class [
  Error,
  EvalError,
  RangeError,
  ReferenceError,
  SyntaxError,
  TypeError,
  URIError,
  WebAssembly.CompileError,
  WebAssembly.LinkError,
  WebAssembly.RuntimeError,
] {
  constructor(message: string, { cause: any }): Error;
}

class AggregateError extends Error {
  constructor(errors: Iterable, message?: string, { cause: any }?): AggregateError;
  errors: Array<any>;
  message: string;
  cause: any;
}

class Error {
  toString(): string; // разные исправления
}

CommonJS точки входа:

core-js(-pure)/es|stable|actual|full/aggregate-error
core-js/es|stable|actual|full/error
core-js/es|stable|actual|full/error/constructor
core-js/es|stable|actual|full/error/to-string

Пример:

const error1 = new TypeError('Ошибка 1');
const error2 = new TypeError('Ошибка 2');
const aggregate = new AggregateError([error1, error2], 'Собранные ошибки');
aggregate.errors[0] === error1; // => true
aggregate.errors[1] === error2; // => true

const cause = new TypeError('Что-то пошло не так');
const error = new TypeError('Здесь объяснено, что пошло не так', { cause });
error.cause === cause; // => true
```Ошибка. прототип. toString. call({ message: 1, name: 2 }) === '2: 1'; // => true
```#### ECMAScript: Массив [](#index)
Модули [`es.array.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.from.js), [`es.array.is-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.is-array.js), [`es.array.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.of.js), [`es.array.copy-within`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.copy-within.js), [`es.array.fill`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.fill.js), [`es.array.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find.js), [`es.array.find-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-index.js), [`es.array.find-last`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-last.js), [`es.array.find-last-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.find-last-index.js), [`es.array.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.iterator.js), [`es.array.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.includes.js), [`es.array.push`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.push.js), [`es.array.slice`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.slice.js), [`es.array.join`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.join.js), [`es.array.unshift`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unshift.js), [`es.array.index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.index-of.js), [`es.array.last-index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.last-index-of.js), [`es.array.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.every.js), [`es.array.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.some.js),com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.some.js), [`es.array.forEach`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.forEach.js), [`es.array.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.map.js), [`es.array.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.filter.js), [`es.array.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reduce.js), [`es.array.reduceRight`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reduceRight.js), [`es.array.reverse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.reverse.js), [`es.array.sort`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.sort.js), [`es.array.flat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.flat.js), [`es.array.flatMap`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.flatMap.js), [`es.array.unscopables.flat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unscopables.flat.js), [`es.array.unscopables.flatMap`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.unscopables.flatMap.js), [`es.array.at`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.at.js), [`es.array.toReversed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.toReversed.js), [`es.array.toSorted`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.toSorted.js), [`es.array.toSpliced`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.toSpliced.js), [`es.array.with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array.with.js).
```ts
class Array {
  at(index: int): any;
  concat(... args: Array<mixed>): Array<mixed>; // с поддержкой @@isConcatSpreadable и @@species
  copyWithin(target: number, start: number, end?: number): this;
  entries(): Iterator<[index, value]>;
  every(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean;
  fill(value: any, start?: number, end?: number): this;
  filter(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): this;
  find(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any;
  findIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): number;
  findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any;
  findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): number;
  flat(depth?: number): Array<any>;
  flatMap(callbackfn: (value: any, index: number, target: any) => any, thisArg?: any): Array<any>;
  forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg?: any): void;
  includes(searchElement: any, fromIndex?: number): boolean;
  indexOf(searchElement: any, fromIndex?: number): number;
  join(separator?: string): string;
  keys(): Iterator<number>;
  lastIndexOf(searchElement: any, fromIndex?: number): number;
  map(callbackfn: (value: any, index: number, target: any) => any, thisArg?: any): Array<any>;
  pop(): any;
  push(... items: any[]): number;
  reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, target: any) => any, initialValue?: any): any;
  reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, target: any) => any, initialValue?: any): any;
  reverse(): this;
  shift(): any;
  slice(start?: number, end?: number): Array<any>;
  some(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean;
  sort(compareFn?: (a: any, b: any) => number): this;
  splice(start: number, deleteCount?: number, ... items: any[]): Array<any>;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed(): this;
  toReversed():```typescript
find(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any;
findIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): number;
findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any;
findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): number;
flat(depthArg?: number = 1): Array<mixed>;
flatMap(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Array<mixed>;
forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg?: any): void;
includes(searchElement: any, from?: number): boolean;
indexOf(searchElement: any, from?: number): number;
join(separator: string = ','): string;
keys(): Iterator<index>;
lastIndexOf(searchElement: any, from?: number): number;
map(mapFn: (value: any, index: number, target: any) => any, thisArg?: any): Array<mixed>; // с поддержкой @@species
push(...args: Array<mixed>): number;
reduce(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any;
reduceRight(callbackfn: (memo: any, value: any, index: number, target: any) => any, initialValue?: any): any;
reverse(): this; // Исправление ошибки Safari 12.0
slice(start?: number, end?: number): Array<mixed>; // с поддержкой @@species
splice(start?: number, deleteCount?: number, ...items: Array<mixed>): Array<mixed>; // с поддержкой @@species
some(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): boolean;
sort(comparefn?: (a: any, b: any) => number): this; // с современным поведением, например, устойчивая сортировка
toReversed(): Array<mixed>;
toSpliced(start?: number, deleteCount?: number, ...items: Array<mixed>): Array<mixed>;
toSorted(comparefn?: (a: any, b: any) => number): Array<mixed>;
unshift(...args: Array<mixed>): number;
values(): Iterator<value>;
with(index: includes, value: any): Array<mixed>;
@@iterator(): Iterator<value>;
@@unscopables: { [newMethodNames: string]: true };
``````markdown
class Arguments {
    @@iterator(): Iterator<value>; // доступен только в методах core-js
}

CommonJS точки входа:

core-js(-pure)/es|стабильный|актуальный|полный/array
core-js(-pure)/es|стабильный|актуальный|полный/array/from
core-js(-pure)/es|стабильный|актуальный|полный/array/of
core-js(-pure)/es|стабильный|актуальный|полный/array/is-array
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/at
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/concat
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/copy-within
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/entries
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/every
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/fill
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/filter
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/find
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/find-index
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/find-last
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/find-last-index
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/flat
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/flat-map
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/for-each
core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/includes
```core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/index-of
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/iterator
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/join
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/keys
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/last-index-of
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/map
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/push
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/reduce
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/reduce-right
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/reverse
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/slice
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/some
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/sort
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/splice
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/to-reversed
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/to-sorted
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/to-spliced
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/unshift
 core-js(-pure)/es|стабильный|актуальный|полный/array(/виртуальный)/values
 ```core-js(-pure)/es|стабильная|актуальная|полная/массив(/виртуальная)/с-примерами

Примеры:

Array.from(new Set([1, 2, 3, 2, 1]));        // => [1, 2, 3]
Array.from({ 0: 1, 1: 2, 2: 3, length: 3 }); // => [1, 2, 3]
```from('123', Number);                   // => [1, 2, 3]
Array.from('123', it => it ** 2);            // => [1, 4, 9]
Массив.of(1);       // => [1]
Массив.of(1, 2, 3); // => [1, 2, 3]```markdown
let массив = ['a', 'b', 'c'];

for (let значение of массив) console.log(значение);          // => 'a', 'b', 'c'
for (let значение of массив.values()) console.log(значение); // => 'a', 'b', 'c'
for (let ключ of массив.keys()) console.log(ключ);           // => 0, 1, 2
for (let [ключ, значение] of массив.entries()) {
console.log(ключ);                                   // => 0, 1, 2
console.log(значение);                               // => 'a', 'b', 'c'
}

function являетсяНечетным(значение) {
return значение % 2;
}
[4, 8, 15, 16, 23, 42].find(являетсяНечетным);      // => 15
[4, 8, 15, 16, 23, 42].findIndex(являетсяНечетным); // => 2
[1, 2, 3, 4].findLast(являетсяНечетным);            // => 3
[1, 2, 3, 4].findLastIndex(являетсяНечетным);       // => 2

Массив(5).fill(42); // => [42, 42, 42, 42, 42]

[1, 2, 3, 4, 5].copyWithin(0, 3); // => [4, 5, 3, 4, 5]

[1, 2, 3].includes(2);        // => true
[1, 2, 3].includes(4);        // => false
[1, 2, 3].includes(2, 2);     // => false

[NaN].indexOf(NaN);           // => -1
[NaN].includes(NaN);          // => true
Массив(1).indexOf(undefined); // => -1
Массив(1).includes(undefined); // => true

[1, [2, 3], [4, 5]].flat();    // => [1, 2, 3, 4, 5]
[1, [2, [3, [4]]], 5].flat();  // => [1, 2, [3, [4]], 5]
[1, [2, [3, [4]]], 5].flat(3); // => [1, 2, 3, 4, 5]

[{ a: 1, b: 2 }, { a: 3, b: 4 }, { a: 5, b: 6 }].flatMap(it => [it.a, it.b]); // => [1, 2, 3, 4, 5, 6]

[1, 2, 3].at(1);  // => 2
[1, 2, 3].at(-1); // => 3

const последовательность = [1, 2, 3];
последовательность.toReversed(); // => [3, 2, 1]
последовательность; // => [1, 2, 3]

const начальныйМассив = [1, 2, 3, 4];
начальныйМассив.toSpliced(1, 2, 5, 6, 7); // => [1, 5, 6, 7, 4]
начальныйМассив; // => [1, 2, 3, 4]

const неупорядоченный = [3, 1, 2];
неупорядоченный.toSorted(); // => [1, 2, 3]
неупорядоченный; // => [3, 1, 2]
``````javascript
const требуютсяИсправления = [1, 1, 3];
требуютсяИсправления.with(1, 2); // => [1, 2, 3]
требуютсяИсправления; // => [1, 1, 3]

ECMAScript: Итератор

Модули [es. iterator. constructor](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. constructor.js), [es. iterator. drop](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. drop.js), [es. iterator. every](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. every.js), [es. iterator. filter](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. filter.js), [es. iterator. find](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. find.js), [es. iterator. flat-map](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. flat-map.js), [es. iterator. for-each](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. for-each.js), [es. iterator. from](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. from.js), [es. iterator. map](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. map.js), [es. iterator. reduce](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. reduce.js), [es. iterator. some](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. some.js), [es. iterator. take](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. take.js), [es. iterator. to-array](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. iterator. to-array.js)

 class Iterator {
   static from(iterable: Iterable<any> | Iterator<any>): Iterator<any>;
   drop(limit: uint): Iterator<any>;
   every(callbackfn: (value: any, counter: uint) => boolean): boolean;
   filter(callbackfn: (value: any, counter: uint) => boolean): Iterator<any>;
   find(callbackfn: (value: any, counter: uint) => boolean): any;
   flatMap(callbackfn: (value: any, counter: uint) => Iterable<any> | Iterator<any>): Iterator<any>;
   forEach(callbackfn: (value: any, counter: uint) => void): void;
   map(callbackfn: (value: any, counter: uint) => any): Iterator<any>;
   reduce(callbackfn: (memo: any, value: any, counter: uint) => any, initialValue: any): any;
   some(callbackfn: (value: any, counter: uint) => boolean): boolean;
   take(limit: uint): Iterator<any>;
   toArray(): Array<any>;
 }
 ``````diff
 - @@toStringTag: 'Итератор'
 - }
 - ```
 - [*CommonJS точки входа:*](#commonjs-api)
 - ```
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/drop
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/every
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/filter
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/find
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/flat-map
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/for-each
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/from
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/map
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/reduce
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/some
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/take
 - core-js(-pure)/es|стабильная|актуальная|полная/итератор/to-array
 - ```
 - [Примеры](https://tinyurl.com/249jw4e4):
 - ```js
 - [1, 2, 3, 4, 5, 6, 7].values()
 -   .drop(1)
 -   .take(5)
 -   .filter(it => it % 2)
 -   .map(it => it ** 2)
 -   .toArray(); // => [9, 25]
 - ```
 ```Итератор из ({
```  next: () => ({ done: Math.random() > 0.9, value: Math.random() * 10 | 0 }),
 }).toArray(); // => [7, 6, 3, 0, 2, 8]
 ```> [!WARNING]
> - Для предотвращения загрязнения прототипа, в "чистой" версии новые методы `%IteratorPrototype%` не добавляются к настоящему `%IteratorPrototype%`, они доступны только на обёртках - вместо `[].values().map(fn)` используйте `Iterator.from([]).map(fn)`.

#### ECMAScript: Строка и RegExp[](#index)
Основные возможности модулей `String`: модули [`es.string.from-code-point`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.from-code-point.js), [`es.string.raw`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.raw.js), [`es.string.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.iterator.js), [`es.string.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js), [`es.string.code-point-at`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.code-point-at.js), [`es.string.ends-with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.ends-with.js), [`es.string.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.includes.js), [`es.string.repeat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.repeat.js), [`es.string.pad-start`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.pad-start.js), [`es.string.pad-end`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.pad-end.js), [`es.string.starts-with`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.starts-with.js), [`es.string.trim`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim.js), [`es.string.trim-start`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim-start.js), [`es.string.trim-end`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.trim-end.js), [`es.string.match-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.match-all.js), [`es.string.replace-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.replace-all.js),com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.replace-all.js), [`es.string.at-alternative`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.at-alternative.js), [`es.string.is-well-formed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.is-well-formed.js), [`es.string.to-well-formed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.to-well-formed.js). Добавление поддержки хорошо известных [символов](#ecmascript-symbol) `@@match`, `@@replace`, `@@search` и `@@split` и прямых вызовов `.exec` к соответствующим методам `String`, модули [`es.string.match`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.match.js), [`es.string.replace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.replace.js), [`es.string.search`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.search.js) и [`es.string.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.split.js).Методы приложения B. Модули [`es.string.anchor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.anchor.js), [`es.string.big`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.big.js), [`es.string.blink`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.blink.js), [`es.string.bold`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.bold.js), [`es.string.fixed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fixed.js), [`es.string.fontcolor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fontcolor.js), [`es.string.fontsize`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.fontsize.js), [`es.string.italics`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.italics.js), [`es.string.link`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.link.js), [`es.string.small`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.small.js), [`es.string.strike`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.strike.js), [`es.string.sub`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.sub.js), [`es.string.sup`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.sup.js), [`es.string.substr`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.string.substr.js), [`es.escape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.escape.js) и [`es.unescape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.unescape.js). Возможности `RegExp`: модули [`es.regexp.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.constructor.js), [`es.regexp.escape`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.escape.js), [`es.regexp.dot-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.dot-all.js), [`es.regexp.flags`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.regexp.flags.js).js), [`es. regexp. sticky`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. regexp. sticky. js) и [`es. regexp. test`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es. regexp. test. js).
```ts
class String {
  static fromCodePoint(...codePoints: Array<number>): string;
  static raw({ raw: Array<string> }, ...substitutions: Array<string>): string;
  at(index: number): string;
  includes(searchString: string, position?: number): boolean;
  startsWith(searchString: string, position?: number): boolean;
  endsWith(searchString: string, position?: number): boolean;
  repeat(count: number): string;
  padStart(length: number, fillStr?: string = ' '): string;
  padEnd(length: number, fillStr?: string = ' '): string;
  codePointAt(pos: number): number | void;
  match(template: any): any; // ES2015+ исправление для поддержки @@match
  matchAll(regexp: RegExp): Iterator;
  replace(template: any, replacer: any): any; // ES2015+ исправление для поддержки @@replace
  replaceAll(searchValue: string | RegExp, replaceString: string | ((searchValue, index, this) => string)): string;
  search(template: any): any; // ES2015+ исправление для поддержки @@search
  split(template: any, limit?: number): Array<string>; // ES2015+ исправление для поддержки @@split, некоторые исправления для старых движков
  trim(): string;
  trimLeft(): string;
  trimRight(): string;
  trimStart(): string;
  trimEnd(): string;
  isWellFormed(): boolean;
  toWellFormed(): string;
  anchor(name: string): string;
  big(): string;
  blink(): string;
  bold(): string;
  fixed(): string;
  fontcolor(color: string): string;
  fontsize(size: any): string;
  italics(): string;
  link(url: string): string;
  small(): string;
  strike(): string;
  sub(): string;
  substr(start: number, length?: number): string;
  sup(): string;
  @@iterator(): Iterator<string>;
}
```

```markdown
class RegExp {
  // поддержка флага sticky (`y`), флага dotAll (`s`), именованных захвата групп, возможность изменения флагов
  constructor(pattern: RegExp | string, flags?: string): RegExp;
  static escape(value: string): string;
  exec(): Array<string | undefined> | null; // исправления для IE8
}
```  test(string: string): boolean; // делегирование к `.exec`
   toString(): string; // исправление для ES2015+ - универсальное
   @@match(string: string): Array | null;
   @@matchAll(string: string): Iterator;
   @@replace(string: string, replaceValue: Function | string): string;
   @@search(string: string): number;
   @@split(string: string, limit: number): Array<string>;
   readonly attribute dotAll: boolean; // IE9+
   readonly attribute flags: string;   // IE9+
   readonly attribute sticky: boolean; // IE9+
 }
 ```функция escape(string: string): string;
 функция unescape(string: string): string;
 ```
 [*CommonJS вводные точки:*](#commonjs-api)
 ```
 core-js(-pure)/es|стабильный|актуальный|полный/string
 core-js(-pure)/es|стабильный|актуальный|полный/string/from-code-point
 core-js(-pure)/es|стабильный|актуальный|полный/string/raw
 core-js/es|стабильный|актуальный|полный/string/match
 core-js/es|стабильный|актуальный|полный/string/replace
 core-js/es|стабильный|актуальный|полный/string/search
 core-js/es|стабильный|актуальный|полный/string/split
 core-js(-pure)/es|стабильный|актуальный/string(/виртуальный)/at
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/code-point-at
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/ends-with
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/includes
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/starts-with
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/match-all
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/pad-start
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/pad-end
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/repeat
 core-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/replace-all
core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/trim
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/trim-start
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/trim-end
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/trim-left
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/trim-right
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/is-well-formed
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/to-well-formed
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/anchor
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/big
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/blink
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/bold
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/fixed
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/fontcolor
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/fontsize
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/italics
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/link
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/small
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/strike
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/sub
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/substr
 core-js(-pure)/es|стабильная|актуальная|полная/string(/виртуальная)/supcore-js(-pure)/es|стабильный|актуальный|полный/string(/виртуальный)/iterator
  core-js/es|стабильный|актуальный|полный/regexp/constructor
  core-js(-pure)/es|стабильный|актуальный|полный/regexp/escape
  core-js/es|стабильный|актуальный|полный/regexp/dot-all
  core-js(-pure)/es|стабильный|актуальный|полный/regexp/flags
  core-js/es|стабильный|актуальный|полный/regexp/sticky
  core-js/es|стабильный|актуальный|полный/regexp/test
  core-js/es|стабильный|актуальный|полный/regexp/to-string
  core-js/es|стабильный|актуальный|полный/escape
  core-js/es|стабильный|актуальный|полный/unescape
  ```
  [*Примеры*](https://tinyurl.com/22uafm3p):
  ```js
  for (let value of 'a𠮷b') {
    console.log(value); // => 'a', '𠮷', 'b'
  }
  'foobarbaz'.includes('bar');      // => true
  'foobarbaz'.includes('bar', 4);   // => false
  'foobarbaz'.startsWith('foo');    // => true
  'foobarbaz'.startsWith('bar', 3); // => true
  'foobarbaz'.endsWith('baz');      // => true
  'foobarbaz'.endsWith('bar', 6);   // => true
  ```'string'.repeat(3); // => 'stringstringstring'

'hello'.padStart(10);         // => '     hello'
'hello'.padStart(10, '1234'); // => '12341hello'
'hello'.padEnd(10);           // => 'hello     '
'hello'.padEnd(10, '1234');   // => 'hello12341'

'𠮷'.codePointAt(0); // => 134071
String.fromCodePoint(97, 134071, 98); // => 'a𠮷b'

let name = 'Bob';
String.raw`Hi\n${ name }!`;           // => 'Hi\\\nBob!' (ES2015 template string syntax)
String.raw({ raw: 'test' }, 0, 1, 2); // => 't0e1s2t'

'foo'.bold();                      // => '<b>foo</b>'
'bar'.anchor('a"b');               // => '<a name="a&quot;b">bar</a>'
'baz'.link('https://example.com'); // => '<a href="https://example.com">baz</a>'

RegExp('.', 's').test('\n'); // => true
RegExp('.', 's').dotAll;     // => true

RegExp('foo:(?<foo>\\\\w+),bar:(?<bar>\\\\w+)').exec('foo:abc,bar:def').groups; // => { foo: 'abc', bar: 'def' }

'foo:abc,bar:def'.replace(RegExp('foo:(?<foo>\\\\w+),bar:(?<bar>\\\\w+)'), '$<bar>,$<foo>'); // => 'def,abc'

// eslint-disable-next-line regexp/no-useless-flag -- example
RegExp(/./g, 'm'); // => /./m

/foo/.flags;   // => ''
/foo/gi.flags; // => 'gi'

RegExp('foo', 'y').sticky; // => true

const text = 'First line\nSecond line';
const regex = RegExp('(?<index>\\\\S+) line\\\\n?', 'y');

regex.exec(text).groups.index; // => 'First'
regex.exec(text).groups.index; // => 'Second'
regex.exec(text);    // => null

'foo'.match({ [Symbol.match]: () => 1 });     // => 1
'foo'.replace({ [Symbol.replace]: () => 2 }); // => 2
'foo'.search({ [Symbol.search]: () => 3 });   // => 3
'foo'.split({ [Symbol.split]: () => 4 });     // => 4

RegExp.prototype.toString.call({ source: 'foo', flags: 'bar' }); // => '/foo/bar'

'   hello   '.trimLeft();  // => 'hello   '
'   hello   '.trimRight(); // => '   hello'
'   hello   '.trimStart(); // => 'hello   '
'   hello   '.trimEnd();   // => '   hello'

for (let { groups: { number, letter } } of '1111a2b3cccc'.matchAll(RegExp('(?<number>\\\\d)(?<letter>\\\\D)', 'g'))) {
  console.log(number, letter); // => 1 a, 2 b, 3 c
}'Test abc test test abc test.'.replaceAll('abc', 'foo'); // -> 'Test foo test test foo test.'

'abc'.at(1);  // => 'b'
'abc'.at(-1); // => 'c'

'a💩b'.isWellFormed();      // => true
'a\\uD83Db'.isWellFormed();  // => false'a💩b'.toWellFormed();      // => 'a💩b'
'a\\uD83Db'.toWellFormed();  // => 'a�b'[*Пример*](https://tinyurl.com/ykac4qgy):
```js
console.log(RegExp.escape('10$')); // => '\\x310\\$'
console.log(RegExp.escape('abcdefg_123456')); // => '\\x61bcdefg_123456'
console.log(RegExp.escape('Привет')); // => 'Привет'
console.log(RegExp.escape('(){}[]|,. ? *+-^$=<>\\\\/#&! %:;@~\\'"`'));
// => '\\\\(\\\\)\\\\{\\\\}\\\\[\\\\]\\\\|\\\\x2c\\\\. \\\\? \\\\*\\\\+\\\\x2d\\\\^\\\\$\\x3d\\x3c\\x3e\\\\\\/\\x23\\x26\\x21\\x25\\x3a\\x3b\\x40\\x7e\\x27\\x22\\x60'
console.log(RegExp.escape('\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'));
// => '\\\t\\\n\\\v\\\f\\\r\\x20\\xa0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029\\ufeff'
console.log(RegExp.escape('💩')); // => '💩'
console.log(RegExp.escape('\uD83D')); // => '\\ud83d'
```
#### ECMAScript: Number[⬆](#index)
Модуль [`es.number.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.constructor.js). Поддержка конструктора `Number` для двоичных и восьмеричных литералов, [*пример*](https://tinyurl.com/2659klkj):
```js
Number('0b1010101'); // => 85
Number('0o7654321'); // => 2054353
```
Модули [`es.number.epsilon`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.epsilon.js), [`es.number.is-finite`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-finite.js), [`es.number.is-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-integer.js), [`es.number.is-nan`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-nan.js), [`es.number.is-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.is-safe-integer.js), [`es.number.max-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.max-safe-integer.js), [`es.number.min-safe-integer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.min-safe-integer.js), [`es.number.parse-float`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.parse-float.js), [`es.number.parse-int`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.parse-int.js),com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.parse-int.js), [`es.number.to-exponential`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-exponential.js), [`es.number.to-fixed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-fixed.js), [`es.number.to-precision`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.number.to-precision.js), [`es.parse-int`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.parse-int.js), [`es.parse-float`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.parse-float.js).
```ts
class Number {
    constructor(value: any): number;
    toExponential(digits: number): string;
    toFixed(digits: number): string;
    toPrecision(precision: number): string;
    static isFinite(number: any): boolean;
    static isNaN(number: any): boolean;
    static isInteger(number: any): boolean;
}
``````markdown
   static являетсяПолнымЦелым(число: any): boolean;
   static parseFloat(строка: string): number;
   static parseInt(строка: string, основание?: number = 10): number;
   static EPSILON: number;
   static MAX_SAFE_INTEGER: number;
   static MIN_SAFE_INTEGER: number;
}
```функция parseFloat(string: string): number;
функция parseInt(string: string, radix?: number = 10): number;
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/number
core-js(-pure)/es|stable|actual|full/number/constructor
core-js(-pure)/es|stable|actual|full/number/is-finite
core-js(-pure)/es|stable|actual|full/number/is-nan
core-js(-pure)/es|stable|actual|full/number/is-integer
core-js(-pure)/es|stable|actual|full/number/is-safe-integer
core-js(-pure)/es|stable|actual|full/number/parse-float
core-js(-pure)/es|stable|actual|full/number/parse-int
core-js(-pure)/es|stable|actual|full/number/epsilon
core-js(-pure)/es|stable|actual|full/number/max-safe-integer
core-js(-pure)/es|stable|actual|full/number/min-safe-integer
core-js(-pure)/es|stable|actual|full/number(/virtual)/to-exponential
core-js(-pure)/es|stable|actual|full/number(/virtual)/to-fixed
core-js(-pure)/es|stable|actual|full/number(/virtual)/to-precision
core-js(-pure)/es|stable|actual|full/parse-float
core-js(-pure)/es|stable|actual|full/parse-int
``` #### ECMAScript: Math[⬆](#index)
  Модули [`es.  math.  acosh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  acosh.  js), [`es.  math.  asinh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  asinh.  js), [`es.  math.  atanh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  atanh.  js), [`es.  math.  cbrt`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  cbrt.  js), [`es.  math.  clz32`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  clz32.  js), [`es.  math.  cosh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  cosh.  js), [`es.  math.  expm1`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  expm1.  js), [`es.  math.  fround`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  fround.  js), [`es.  math.  f16round`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  f16round.  js), [`es.  math.  hypot`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  hypot.  js), [`es.  math.  imul`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  imul.  js), [`es.  math.  log10`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  log10.  js), [`es.  math.  log1p`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  log1p.  js), [`es.  math.  log2`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  log2.  js), [`es.  math.  sign`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  sign.  js), [`es.  math.  sinh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  sinh.  js), [`es.  math.  tanh`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  tanh.  js), [`es.  math.  trunc`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  math.  trunc.  js).
 ```ts
 namespace Math {
    acosh(number: number): number;
    asinh(number: number): number;
    atanh(number: number): number;
    cbrt(number: number): number;
}   clz32(number: number): number;
    cosh(number: number): number;
    expm1(number: number): number;
    fround(number: number): number;
    f16round(number: any): number;
    hypot(... args: Array<number>): number;
    imul(number1: number, number2: number): number;
    log1p(number: number): number;
    log10(number: number): number;
    log2(number: number): number;
    sign(number: number): 1 | -1 | 0 | -0 | NaN;
    sinh(number: number): number;
    tanh(number: number): number;
    trunc(number: number): number;
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js(-pure)/es|stable|actual|full/math
 core-js(-pure)/es|stable|actual|full/math/acosh
 core-js(-pure)/es|stable|actual|full/math/asinh
 core-js(-pure)/es|stable|actual|full/math/atanh
 core-js(-pure)/es|stable|actual|full/math/cbrt
 core-js(-pure)/es|stable|actual|full/math/clz32
 core-js(-pure)/es|stable|actual|full/math/cosh
 core-js(-pure)/es|stable|actual|full/math/expm1
 core-js(-pure)/es|stable|actual|full/math/fround
 core-js(-pure)/es|stable|actual|full/math/f16round
 core-js(-pure)/es|stable|actual|full/math/hypot
 core-js(-pure)/es|stable|actual|full/math/imul
 core-js(-pure)/es|stable|actual|full/math/log1p
 core-js(-pure)/es|stable|actual|full/math/log10
 core-js(-pure)/es|stable|actual|full/math/log2
 core-js(-pure)/es|stable|actual|full/math/sign
 core-js(-pure)/es|stable|actual|full/math/sinh
 core-js(-pure)/es|stable|actual|full/math/tanh
 core-js(-pure)/es|stable|actual|full/math/trunc
 ```
 #### ECMAScript: Date[⬆](#index)
 Модули `es.date.to-string` ([`es.date.to-string.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-string.js)), ES5-функции с исправлениями: `es.date.now` ([`es.date.now.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.now.js)), `es.date.to-iso-string` ([`es.date.to-iso-string.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-iso-string.js)), `es.date.to-json` ([`es.date.to-json.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-json.js)) и `es.date.to-primitive` ([`es.date.to-primitive.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-primitive.js)). Методы. Модули `es.date.get-year` ([`es.date.get-year.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.get-year.js)), `es.date.set-year` ([`es.date.set-year.js`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.set-year.js)).com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.set-year.js) и [`es.date.to-gmt-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.date.to-gmt-string.js).
```ts
class Date {
  getYear(): number;
  setYear(year: number): number;
  toGMTString(): string;
  toISOString(): string;
  toJSON(): string;
  toString(): string;
  @@toPrimitive(hint: 'default' | 'number' | 'string'): string | number;
  static now(): number;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/es|stable|actual|full/date
core-js/es|stable|actual|full/date/to-string
core-js(-pure)/es|stable|actual|full/date/now
core-js(-pure)/es|stable|actual|full/date/get-year
core-js(-pure)/es|stable|actual|full/date/set-year
core-js(-pure)/es|stable|actual|full/date/to-gmt-string
core-js(-pure)/es|stable|actual|full/date/to-iso-string
core-js(-pure)/es|stable|actual|full/date/to-json
core-js(-pure)/es|stable|actual|full/date/to-primitive
```
[*Пример*](https://tinyurl.com/2cngq74c):
```js
new Date(NaN).toString(); // => 'Invalid Date'
```
#### ECMAScript: Promise[⬆](#index)
Модули [`es.promise`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.js), [`es.promise.all-settled`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.all-settled.js), [`es.promise.any`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.any.js), [`es.promise.finally`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.finally.js), [`es.promise.try`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.try.js) и [`es.promise.with-resolvers`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.with-resolvers.js).
```ts
class Promise {
  constructor(executor: (resolve: Function, reject: Function) => void): Promise;
  then(onFulfilled: Function, onRejected: Function): Promise;
  catch(onRejected: Function): Promise;
  finally(onFinally: Function): Promise;
  static all(iterable: Iterable): Promise;
  static allSettled(iterable: Iterable): Promise;
  static any(promises: Iterable): Promise;
  static race(iterable: Iterable): Promise;
  static reject(r: any): Promise;
  static resolve(x: any): Promise;
  static try(callbackfn: Function, ...args?: Array<mixed>): Promise;
}
```  static withResolvers(): { promise: Promise, resolve: Function, reject: Function };
 }
 ```
 [*CommonJS точки входа:*](#commonjs-api)
 ```
 core-js(-pure)/es|stable|actual|full/promise
 core-js(-pure)/es|stable|actual|full/promise/all-settled
 core-js(-pure)/es|stable|actual|full/promise/any
 core-js(-pure)/es|stable|actual|full/promise/finally
 core-js(-pure)/es|stable|actual|full/promise/try
 core-js(-pure)/es|stable|actual|full/promise/with-resolvers
 ```
 Пример с базовыми настройками [*пример*](https://tinyurl.com/23bhbhbu):
 ```js
 /* eslint-disable promise/prefer-await-to-callbacks -- пример */
 function sleepRandom(time) {
   return new Promise((resolve, reject) => {
     setTimeout(resolve, time * 1e3, 0 | Math.random() * 1e3);
   });
 }
 ```

Пример с базовыми настройками:
```js
/* eslint-disable promise/prefer-await-to-callbacks -- пример */
function sleepRandom(time) {
  return new Promise((resolve, reject) => {
    setTimeout(resolve, time * 1e3, 0 | Math.random() * 1e3);
  });
}
```

Пример с базовыми настройками:
```js
/* eslint-disable promise/prefer-await-to-callbacks -- пример */
Promise.resolve(42).then(x => console.log(x)); // => 42
Promise.reject(42).catch(error => console.log(error)); // => 42
```

Пример с базовыми настройками:
```js
/* eslint-disable promise/prefer-await-to-callbacks -- пример */
console.log('Запуск'); // => Запуск
sleepRandom(5).then(result => {
  console.log(result); // => 869, через 5 сек.
  return sleepRandom(10);
}).then(result => {
  console.log(result); // => 202, через 10 сек.
}).then(() => {
  console.log('немедленно после'); // => немедленно после
  throw new Error('Irror! ');
}).then(() => {
  console.log('не будет отображено');
}).catch(error => console.log(error)); // => Error: Irror!
```Promise.resolve($.getJSON('/data.json')); // => ES promise
```
`Promise#finally` [*пример*](https://tinyurl.com/2ywzmz72):
```js
Promise.resolve(42).finally(() => console.log('Вы всё равно увидите это'));

Promise.reject(42).finally(() => console.log('Вы всё равно увидите это'));
```
`Promise.all` [*пример*](https://tinyurl.com/23nc596a):
```js
Promise.all([
  'foo',
  sleepRandom(5),
  sleepRandom(15),
  sleepRandom(10),            // через 15 сек:
]).then(x => console.log(x)); // => ['foo', 956, 85, 382]
```
`Promise.race` [*пример*](https://tinyurl.com/2degj8ux):
```js
/* eslint-disable promise/prefer-await-to-callbacks -- пример */
function timeLimit(promise, time) {
  return Promise.race([promise, new Promise((resolve, reject) => {
    setTimeout(reject, time * 1e3, new Error(`Ожидание > ${ time } сек`));
  })]);
}

timeLimit(sleepRandom(5), 10).then(x => console.log(x));           // => 853, через 5 сек.
timeLimit(sleepRandom(15), 10).catch(error => console.log(error)); // Error: Ожидание > 10 сек
```
`Promise.allSettled` [*пример*](https://tinyurl.com/2akj7c2u):
```js
Promise.allSettled([
  Promise.resolve(1),
  Promise.reject(2),
  Promise.resolve(3),
]).then(console.log); // => [{ value: 1, status: 'выполнено' }, { reason: 2, status: 'отклонено' }, { value: 3, status: 'выполнено' }]
```
`Promise.any` [*пример*](https://tinyurl.com/23u59v6g):
```js
Promise.any([
  Promise.resolve(1),
  Promise.reject(2),
  Promise.resolve(3),
]).then(console.log); // => 1
```
```js
Promise.any([
  Promise.reject(1),
  Promise.reject(2),
  Promise.reject(3),
]).catch(({ errors }) => console.log(errors)); // => [1, 2, 3]
```
`Promise.try` [*примеры*](https://tinyurl.com/2p48ojau):
```js
/* eslint-disable promise/prefer-await-to-callbacks -- пример */
Promise.try(() => 42).then(it => console.log(`Promise, разрешен как ${ it }`));
Promise.try(() => { throw new Error('42'); }).catch(error => console.log(`Promise, отклонен как ${ error }`));

Promise.try(async () => 42).then(it => console.log(`Promise, разрешен как ${ it }`));

Promise.try(async () => { throw new Error('42'); }).catch(error => console.log(`Promise, отклонен как ${ error }`));
```Promise.try(it => it, 42).then(it => console.log(`Promise, разрешен как ${it}`));
```
`Promise.withResolvers` [*примеры*](https://tinyurl.com/2gx4t3xu):
```js
const d = Promise.withResolvers();
d.resolve(42);
d.promise.then(console.log); // => 42
```
[Пример](https://tinyurl.com/bde6am73) с асинхронными функциями:
```js
let delay = time => new Promise(resolve => setTimeout(resolve, time));

async function sleepRandom(time) {
  await delay(time * 1e3);
  return 0 | Math.random() * 1e3;
}

async function sleepError(time, msg) {
  await delay(time * 1e3);
  throw new Error(msg);
}

(async () => {
  try {
    console.log('Запуск');                // => Запуск
    console.log(await sleepRandom(5));     // => 936, после 5 сек.
    let [a, b, c] = await Promise.all([
      sleepRandom(5),
      sleepRandom(15),
      sleepRandom(10),
    ]);
    console.log(a, b, c);                 // => 210 445 71, после 15 сек.
    await sleepError(5, 'Ошибка!');
    console.log('Не будет отображено');
  } catch (error) {
    console.log(error);                   // => Ошибка: 'Ошибка!', после 5 сек.
  }
})();
```

##### Отслеживание необработанных отклонений[⬆](#index)

В Node.js, как и в стандартной реализации, доступны события [`unhandledRejection`](https://nodejs.org/api/process.html#process_event_unhandledrejection) и [`rejectionHandled`](https://nodejs.org/api/process.html#process_event_rejectionhandled):
```js
process.on('unhandledRejection', (reason, promise) => console.log('необработанное', reason, promise));
process.on('rejectionHandled', promise => console.log('обработанное', promise));
``````javascript
let promise = Promise.reject(42);
// необработанное 42 [объект Promise]
```
// eslint-disable-next-line promise/prefer-await-to-then -- пример
setTimeout(() => promise.catch(() => { /* пустое */ }), 1e3);
// обработан [объект Promise]
```
В браузере при отклонении по умолчанию вы увидите уведомление в консоли, или можете добавить пользовательский обработчик и обработчик для необработанных отклонений, [*пример*](https://tinyurl.com/5n6nj2e8):
```js
globalThis.addEventListener('unhandledrejection', e => console.log('необработано', e.reason, e.promise));
globalThis.addEventListener('rejectionhandled', e => console.log('обработано', e.reason, e.promise));
// или
globalThis.onunhandledrejection = e => console.log('необработано', e.reason, e.promise);
globalThis.onrejectionhandled = e => console.log('обработано', e.reason, e.promise);
``````markdown
Допустим, что promise = Promise.reject(42);
// => необработанное 42 [объект Promise]

// eslint-disable-next-line promise/prefer-await-to-then -- пример
setTimeout(() => promise.catch(() => { /* пустое */ }), 1000);
// => обработанное 42 [объект Promise]
``````#### ECMAScript: Symbol[⬆](#index)
Модули [`es.symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.js), [`es.symbol.async-iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.async-iterator.js), [`es.symbol.description`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.description.js), [`es.symbol.has-instance`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.has-instance.js), [`es.symbol.is-concat-spreadable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.is-concat-spreadable.js), [`es.symbol.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.iterator.js), [`es.symbol.match`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.match.js), [`es.symbol.replace`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.replace.js), [`es.symbol.search`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.search.js), [`es.symbol.species`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.species.js), [`es.symbol.split`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.split.js), [`es.symbol.to-primitive`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.to-primitive.js), [`es.symbol.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.to-string-tag.js), [`es.symbol.unscopables`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.symbol.unscopables.js), [`es.math.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.math.to-string-tag.js).
```ts
class Symbol {
  constructor(description?: string): symbol;
  readonly description: string | void;
  static asyncIterator: @@asyncIterator;
  static hasInstance: @@hasInstance;
  static isConcatSpreadable: @@isConcatSpreadable;
  static iterator: @@iterator;
  static match: @@match;
  static replace: @@replace;
  static search: @@search;
  static species: @@species;
  static split: @@split;
  static toPrimitive: @@toPrimitive;
  static toStringTag: @@toStringTag;
}
``````markdown
## Symbol

Тип документа для перевода: markdown  
Язык исходного текста: китайский и английский  
Язык финального текста: русский

```typescript
class Symbol {
  static unscopables: @@unscopables;
  static для(key: string): symbol;
  static ключДля(sym: symbol): string;
  static использоватьПростое(): void;
  static использоватьСеттер(): void;
}
```

Также обернули некоторые методы для правильной работы с полифиллом `Symbol`.
```typescript
class Object {
  static create(prototype: Object | null, properties? : { [property: PropertyKey]: PropertyDescriptor }): Object;
  static defineProperties(object: Object, properties: { [property: PropertyKey]: PropertyDescriptor }): Object;
  static defineProperty(object: Object, property: PropertyKey, attributes: PropertyDescriptor): Object;
  static getOwnPropertyDescriptor(object: any, property: PropertyKey): PropertyDescriptor | void;
  static getOwnPropertyNames(object: any): Array<string>;
  propertyIsEnumerable(key: PropertyKey): boolean;
}
```

[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/symbol
core-js(-pure)/es|stable|actual|full/symbol/async-iterator
core-js/es|stable|actual|full/symbol/description
core-js(-pure)/es|stable|actual|full/symbol/has-instance
core-js(-pure)/es|stable|actual|full/symbol/is-concat-spreadable
core-js(-pure)/es|stable|actual|full/symbol/iterator
core-js(-pure)/es|stable|actual|full/symbol/match
core-js(-pure)/es|stable|actual|full/symbol/replace
core-js(-pure)/es|stable|actual|full/symbol/search
core-js(-pure)/es|stable|actual|full/symbol/species
core-js(-pure)/es|stable|actual|full/symbol/split
core-js(-pure)/es|stable|actual|full/symbol/to-primitive
core-js(-pure)/es|stable|actual|full/symbol/to-string-tag
core-js(-pure)/es|stable|actual|full/symbol/unscopables
core-js(-pure)/es|stable|actual|full/symbol/for
core-js(-pure)/es|stable|actual|full/symbol/key-for
core-js(-pure)/es|stable|actual|full/object/get-own-property-symbols
core-js(-pure)/es|stable|actual|full/math/to-string-tag
```

[*Пример базового использования*](https://tinyurl.com/2b2zfvrs):
```js
let Person = (() => {
  let NAME = Symbol('name');
  return class {
    constructor(name) {
      this[NAME] = name;
    }
    getName() {
      return this[NAME];
    }
  };
})();
```

```js
let person = new Person('Вася');
console.log(person);
``````markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  // => ['a']
Object.getOwnPropertyNames(object);   // => ['a', 'b']
Object.getOwnPropertySymbols(object); // => [Symbol(c)]
Reflect.ownKeys(object);              // => ['a', 'b', Symbol(c)]
```
[*Symbol#description getter*](https://tinyurl.com/25s4664f):
```js
Symbol('foo').description; // => 'foo'
// eslint-disable-next-line symbol-description -- пример
Symbol().description;      // => undefined
```
##### Внимание при использовании `Symbol` polyfill:[⬆](#index)
```markdown
getName()));            // => 'Вася'
console.log(person.name);                 // => undefined
console.log(person[Symbol('name')]);      // => undefined, символы уникальны
for (let key in person) console.log(key); // => ничего, символы не перечисляемы
```
`Symbol.for` & `Symbol.keyFor` [*пример*](https://tinyurl.com/29u2q3jb):
```js
let symbol = Symbol.for('ключ');
symbol === Symbol.for('ключ'); // true
Symbol.keyFor(symbol);        // 'ключ'
```
[*Пример*](https://tinyurl.com/2297e9bg) с методами для получения собственных ключей объекта:
```js
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Object.keys(object);                  //- Мы не можем добавить новый примитивный тип, `Symbol` возвращает объект.
- `Symbol.for` и `Symbol.keyFor` не могут быть polyfilled кросс-реалм.
- По умолчанию, чтобы скрыть ключи, `Symbol` polyfill определяет сеттер в `Object.prototype`. По этой причине, неуправляемое создание символов может вызвать утечку памяти, и оператор `in` не работает правильно с `Symbol` polyfill: `Symbol() in {} // => true`.

Вы можете отключить определение сеттеров в `Object.prototype`. [Пример](https://tinyurl.com/2blse6aa):
```js
Symbol.useSimple();
let symbol1 = Symbol('symbol1');
let object1 = {};
object1[symbol1] = true;
for (let key in object1) console.log(key); // => 'Symbol(symbol1)_t.qamkg9f3q', без native Symbol
```Symbol.useSetter();
let symbol2 = Symbol('symbol2');
let object2 = {};
object2[symbol2] = true;
for (let key in object2) console.log(key); // ничего
```
- В настоящее время `core-js` не добавляет сеттеры в `Object.prototype` для хорошо известных символов для правильной работы чего-то вроде `Symbol.iterator in foo`. Это может вызвать проблемы с их перечисляемостью.
- Некоторые проблемы возможны с экзотическими объектами окружения (например, IE `localStorage`).

#### ECMAScript: Сборки[⬆](#index)
`core-js` использует native коллекции в большинстве случаев, просто исправляет методы / конструкторы, если это необходимо, а в старых окружениях использует быстрое полифиллинг (O(1) поиск).
#### Map[⬆](#index)
Модули [`es.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.map.js) и [`es.map.group-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.map.group-by.js).
```ts
class Map {
  constructor(iterable?: Iterable<[key, value]>): Map;
  clear(): void;
  delete(key: any): boolean;
  forEach(callbackfn: (value: any, key: any, target: any) => void, thisArg: any): void;
  get(key: any): any;
  has(key: any): boolean;
  set(key: any, val: any): this;
  values(): Iterator<value>;
  keys(): Iterator<key>;
  entries(): Iterator<[key, value]>;
  @@iterator(): Iterator<[key, value]>;
  readonly attribute size: number;
  static groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): Map<key, Array<mixed>>;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/map
core-js(-pure)/es|stable|actual|full/map/group-by
```
[*Примеры*](https://tinyurl.com/yn2w5s8v):
```js
let array = [1];
``````markdown
Допустим, создадим карту:
```javascript
let map = new Map([['a', 1], [42, 2]]);
map.set(array, 3).set(true, 4);
```
```javascript
console.log(map.size);        // => 4
console.log(map.has(array));  // => true
console.log(map.has([1]));    // => false
console.log(map.get(array));  // => 3
```
```javascript
map.forEach((val, key) => {
  console.log(val);           // => 1, 2, 3, 4
  console.log(key);           // => 'a', 42, [1], true
});
```
```javascript
map.delete(array);
console.log(map.size);        // => 3
console.log(map.get(array));  // => undefined
console.log(Array.from(map)); // => [['a', 1], [42, 2], [true, 4]]
```
```javascript
map = new Map([['a', 1], ['b', 2], ['c', 3]]);
```
```javascript
for (let [key, value] of map) {
  console.log(key);                                 // => 'a', 'b', 'c'
  console.log(value);                               // => 1, 2, 3
}
```
```javascript
for (let value of map.values()) console.log(value); // => 1, 2, 3
```
```javascript
for (let key of map.keys()) console.log(key);       // => 'a', 'b', 'c'
```
```javascript
for (let [key, value] of map.entries()) {
  console.log(key);                                 // => 'a', 'b', 'c'
  console.log(value);                               // => 1, 2, 3
}
```
``````md
map = Map.groupBy([1, 2, 3, 4, 5], it => it % 2);
console.log(map.get(1)); // => [1, 3, 5]
console.log(map.get(0)); // => [2, 4]
```#### Set[⬆](#index)
Модули [`es.set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.js), [`es.set.difference.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.difference.v2.js), [`es.set.intersection.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.intersection.v2.js), [`es.set.is-disjoint-from.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-disjoint-from.v2.js), [`es.set.is-subset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-subset-of.v2.js), [`es.set.is-superset-of.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.is-superset-of.v2.js), [`es.set.symmetric-difference.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.symmetric-difference.v2.js), [`es.set.union.v2`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.set.union.v2.js)
```ts
class Set {
  constructor(iterable?: Iterable<value>): Set;
  add(key: any): this;
  clear(): void;
  delete(key: any): boolean;
  forEach((value: any, key: any, target: any) => void, thisArg: any): void;
  has(key: any): boolean;
  values(): Iterator<value>;
  keys(): Iterator<value>;
  entries(): Iterator<[value, value]>;
  difference(other: SetLike<mixed>): Set;
  intersection(other: SetLike<mixed>): Set;
  isDisjointFrom(other: SetLike<mixed>): boolean;
  isSubsetOf(other: SetLike<mixed>): boolean;
  isSupersetOf(other: SetLike<mixed>): boolean;
  symmetricDifference(other: SetLike<mixed>): Set;
  union(other: SetLike<mixed>): Set;
  @@iterator(): Iterator<value>;
  readonly attribute size: number;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/set
core-js(-pure)/es|stable|actual|full/set/difference
core-js(-pure)/es|stable|actual|full/set/intersection
core-js(-pure)/es|stable|actual|full/set/is-disjoint-from
core-js(-pure)/es|stable|actual|full/set/is-subset-of
core-js(-pure)/es|stable|actual|full/set/is-superset-of
core-js(-pure)/es|stable|actual|full/set/symmetric-difference
core-js(-pure)/es|stable|actual|full/set/union
```
[*Примеры*](https://tinyurl.com/2dy5t9ey):
```js
``````markdown
Допустим, set = new Set(['a', 'b', 'a', 'c']);
set.add('d').add('b').add('e');
console.log(set.size);        // => 5
console.log(set.has('b'));    // => true
set.forEach(it => {
  console.log(it);            // => 'a', 'b', 'c', 'd', 'e'
});
set.delete('b');
console.log(set.size);        // => 4
console.log(set.has('b'));    // => false
console.log(Array.from(set)); // => ['a', 'c', 'd', 'e']
```

Так как в данном случае код и комментарии на английском, они оставлены без изменений, а текстовые описания переведены на русский.```ts
set = new Set([1, 2, 3, 2, 1]);

for (let value of set) console.log(value);          // => 1, 2, 3
for (let value of set.values()) console.log(value); // => 1, 2, 3
for (let key of set.keys()) console.log(key);       // => 1, 2, 3
for (let [key, value] of set.entries()) {
  console.log(key);                                 // => 1, 2, 3
  console.log(value);                               // => 1, 2, 3
}

new Set([1, 2, 3]).union(new Set([3, 4, 5]));               // => Set {1, 2, 3, 4, 5}
new Set([1, 2, 3]).intersection(new Set([3, 4, 5]));        // => Set {3}
new Set([1, 2, 3]).difference(new Set([3, 4, 5]));          // => Set {1, 2}
new Set([1, 2, 3]).symmetricDifference(new Set([3, 4, 5])); // => Set {1, 2, 4, 5}
new Set([1, 2, 3]).isDisjointFrom(new Set([4, 5, 6]));      // => true
new Set([1, 2, 3]).isSubsetOf(new Set([5, 4, 3, 2, 1]));    // => true
new Set([5, 4, 3, 2, 1]).isSupersetOf(new Set([1, 2, 3]));  // => true
```
#### WeakMap[⬆](#index)
Модуль [`es.weak-map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.weak-map.js).
```ts
class WeakMap {
  constructor(iterable?: Iterable<[key, value]>): WeakMap;
  delete(key: Object): boolean;
  get(key: Object): any;
  has(key: Object): boolean;
  set(key: Object, val: any): this;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/weak-map
```
[*Примеры*](https://tinyurl.com/2yws9shh):
```js
let a = [1];
let b = [2];
let c = [3];

let weakmap = new WeakMap([[a, 1], [b, 2]]);
weakmap.set(c, 3).set(b, 4);
console.log(weakmap.has(a));   // => true
console.log(weakmap.has([1])); // => false
console.log(weakmap.get(a));   // => 1
weakmap.delete(a);
console.log(weakmap.get(a));   // => undefined
```// Хранение приватных свойств:
let Person = (() => {
  let names = new WeakMap();
  return class {
    constructor(name) {
      names.set(this, name);
    }
    getName() {
      return names.get(this);
    }
  };
})();
``````md
Допустим, что `person` — это новый экземпляр класса `Person` с именем 'Vasya'.
```js
let person = new Person('Vasya');
console.log(person.getName());            // => 'Vasya'
```
Цикл `for...in` выводит только ключи объекта.
```js
for (let key in person) console.log(key); // => только 'getName'
```
#### WeakSet[⬆](#index)
Модуль [`es.weak-set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.weak-set.js).
```ts
class WeakSet {
  constructor(iterable?: Iterable<value>): WeakSet;
  add(key: Object): this;
  delete(key: Object): boolean;
  has(key: Object): boolean;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/weak-set
```
[*Примеры*](https://tinyurl.com/2ceoza3j):
```js
let a = [1];
let b = [2];
let c = [3];
```
``````markdown
Допустим, что `weakset = new WeakSet([a, b, a])`;
weakset.add(c).add(b).add(c);
console.log(weakset.has(b));   // => true
console.log(weakset.has([2])); // => false
weakset.delete(b);
console.log(weakset.has(b));   // => false
```

> [!WARNING]
> - Полифилл для слабых коллекций хранит значения как скрытые свойства ключей. Это работает правильно и не приводит к утечке памяти в большинстве случаев. Однако, желательно хранить коллекцию дольше, чем её ключи.
> - Нативные символы, такие как ключи `WeakMap`, не могут быть правильно полифиллированы без утечек памяти.#### ECMAScript: Типизированные массивы[⬆](#index)
Реализации и исправления для `ArrayBuffer`, `DataView`, конструкторов типизированных массивов, статических методов и методов прототипа. Типизированные массивы работают только в средах с поддержкой дескрипторов (IE9+), `ArrayBuffer` и `DataView` должны работать везде. Модули [`es.array-buffer.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.constructor.js), [`es.array-buffer.is-view`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.is-view.js), [`esnext.array-buffer.detached`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.detached.js), [`es.array-buffer.slice`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.array-buffer.slice.js), [`esnext.array-buffer.transfer`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.transfer.js), [`esnext.array-buffer.transfer-to-fixed-length`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js), [`es.data-view`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.data-view.js), [`es.data-view.get-float16`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.data-view.get-float16.js), [`es.data-view.set-float16`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.data-view.set-float16.js), [`es.typed-array.int8-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int8-array.js), [`es.typed-array.uint8-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint8-array.js), [`es.typed-array.uint8-clamped-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint8-clamped-array.js), [`es.typed-array.int16-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int16-array.js), [`es.typed-array.uint16-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint16-array.js), [`es.typed-array.int32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.int32-array.js), [`es.typed-array.uint32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.uint32-array.js), [`es.typed-array.float32-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.float32-array.js), [`es.typed-array.float64-array`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.float64-array.js),com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.float64-array.js), [`es.typed-array.copy-within`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.copy-within.js), [`es.typed-array.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.every.js), [`es.typed-array.fill`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.fill.js), [`es.typed-array.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.filter.js), [`es.typed-array.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find.js), [`es.typed-array.find-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-index.js), [`es.typed-array.find-last`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-last.js), [`es.typed-array.find-last-index`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.find-last-index.js), [`es.typed-array.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.for-each.js), [`es.typed-array.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.from.js), [`es.typed-array.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.includes.js), [`es.typed-array.index-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.index-of.js),typed-array.  index-of.  js), [`es.  typed-array.  iterator`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  iterator.  js), [`es.  typed-array.  last-index-of`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  last-index-of.  js), [`es.  typed-array.  map`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  map.  js), [`es.  typed-array.  of`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  of.  js), [`es.  typed-array.  reduce`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  reduce.  js), [`es.  typed-array.  reduce-right`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  reduce-right.  js), [`es.  typed-array.  reverse`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  reverse.  js), [`es.  typed-array.  set`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  set.  js), [`es.  typed-array.  slice`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  slice.  js), [`es.  typed-array.  some`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  some.  js), [`es.  typed-array.  sort`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  sort.  js), [`es.  typed-array.  subarray`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  subarray.  js), [`es.  typed-array.  to-locale-string`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  to-locale-string.  js), [`es.  typed-array.  to-string`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  to-string.  js), [`es.  typed-array.  at`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  at.  js), [`es.  typed-array.  to-reversed`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  to-reversed.  js), [`es.  typed-array.  to-sorted`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  to-sorted.  js), [`es.  typed-array.  with`](https://github.  com/zloirock/core-js/blob/master/packages/core-js/modules/es.  typed-array.  with.  js)com/zloirock/core-js/blob/master/packages/core-js/modules/es.typed-array.with.js)```ts
class ArrayBuffer {
  constructor(length: any): ArrayBuffer;
  readonly byteLength: number;
  readonly detached: boolean;
  slice(start: any, end: any): ArrayBuffer;
  transfer(newLength?: number): ArrayBuffer;
  transferToFixedLength(newLength?: number): ArrayBuffer;
  static isView(arg: any): boolean;
}
``````markdown
class DataView {
  constructor(buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
  getInt8(offset: any): number;
  getUint8(offset: any): number;
  getInt16(offset: any, littleEndian?: boolean = false): number;
  getUint16(offset: any, littleEndian?: boolean = false): number;
  getInt32(offset: any, littleEndian?: boolean = false): number;
  getUint32(offset: any, littleEndian?: boolean = false): number;
  getFloat16(offset: any, littleEndian?: boolean = false): number;
  getFloat32(offset: any, littleEndian?: boolean = false): number;
  getFloat64(offset: any, littleEndian?: boolean = false): number;
  setInt8(offset: any, value: any): void;
  setUint8(offset: any, value: any): void;
  setInt16(offset: any, value: any, littleEndian?: boolean = false): void;
  setUint16(offset: any, value: any, littleEndian?: boolean = false): void;
  setInt32(offset: any, value: any, littleEndian?: boolean = false): void;
  setUint32(offset: any, value: any, littleEndian?: boolean = false): void;
  setFloat16(offset: any, value: any, littleEndian?: boolean = false): void;
  setFloat32(offset: any, value: any, littleEndian?: boolean = false): void;
  setFloat64(offset: any, value: any, littleEndian?: boolean = false): void;
  readonly attribute buffer: ArrayBuffer;
  readonly attribute byteLength: number;
  readonly attribute byteOffset: number;
}```markdown
class [
   Int8Array,
   Uint8Array,
   Uint8ClampedArray,
   Int16Array,
   Uint16Array,
   Int32Array,
   Uint32Array,
   Float32Array,
   Float64Array,
 ] extends %TypedArray% {
   constructor(length: number): %TypedArray%;
   constructor(object: %TypedArray% | Iterable | ArrayLike): %TypedArray%;
   constructor(buffer: ArrayBuffer, byteOffset?: number, length?: number): %TypedArray%
 }
 ``````markdown
 class %TypedArray% {
    at(index: number): number;
    copyWithin(target: number, start: number, end?: number): this;
    entries(): Iterator<[index, value]>;
    every(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): boolean;
    fill(value: number, start?: number, end?: number): this;
    filter(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): %TypedArray%;
    find(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): any;
    findIndex(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): number;
    findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any;
    findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): number;
    forEach(callbackfn: (value: number, index: number, target: %TypedArray%) => void, thisArg?: any): void;
    includes(searchElement: any, from?: number): boolean;
    indexOf(searchElement: any, from?: number): number;
    join(separator: string = ','): string;
    keys(): Iterator<number>;
    lastIndexOf(searchElement: any, from?: number): number;
    map(mapFn: (value: number, index: number, target: %TypedArray%) => number, thisArg?: any): %TypedArray%;
    reduce(callbackfn: (memo: any, value: number, index: number, target: %TypedArray%) => any, initialValue?: any): any;
    reduceRight(callbackfn: (memo: any, value: number, index: number, target: %TypedArray%) => any, initialValue?: any): any;
    reverse(): this;
    set(array: ArrayLike, offset?: number): void;
    slice(start?: number, end?: number): %TypedArray%;
    some(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): boolean;
    sort(comparefn?: (a: number, b: number) => number): this; // с современным поведением, например, устойчивая сортировка
    subarray(begin?```markdown
### Статические методы

```javascript
static from(items: Iterable | ArrayLike, mapFn?: (value: any, index: number) => any, thisArg?: any): %TypedArray%;
static of(...args: Array<mixed>): %TypedArray%;
```

### Статические константы

```javascript
static readonly attribute BYTES_PER_ELEMENT: number;
```

### CommonJS точки входа

```javascript
core-js/es/array-buffer
core-js/es/array-buffer/constructor
core-js/es/array-buffer/is-view
core-js/es/array-buffer/detached
core-js/es/array-buffer/slice
core-js/es/array-buffer/transfer
core-js/es/array-buffer/transfer-to-fixed-length
core-js/es/data-view
core-js/es/dataview/get-float16
core-js/es/dataview/set-float16
core-js/es/typed-array
core-js/es/typed-array/int8-array
core-js/es/typed-array/uint8-array
core-js/es/typed-array/uint8-clamped-array
core-js/es/typed-array/int16-array
core-js/es/typed-array/uint16-array
core-js/es/typed-array/int32-array
```
```  core-js/es|стабильная|актуальная|полная/typed-array/uint32-array
   core-js/es|стабильная|актуальная|полная/typed-array/float32-array
   core-js/es|стабильная|актуальная|полная/typed-array/float64-array
   core-js/es|стабильная|актуальная|полная/typed-array/at
   core-js/es|стабильная|актуальная|полная/typed-array/copy-within
   core-js/es|стабильная|актуальная|полная/typed-array/entries
   core-js/es|стабильная|актуальная|полная/typed-array/every
   core-js/es|стабильная|актуальная|полная/typed-array/fill
   core-js/es|стабильная|актуальная|полная/typed-array/filter
   core-js/es|стабильная|актуальная|полная/typed-array/find
   core-js/es|стабильная|актуальная|полная/typed-array/find-index
   core-js/es|стабильная|актуальная|полная/typed-array/find-last
   core-js/es|стабильная|актуальная|полная/typed-array/find-last-index
   core-js/es|стабильная|актуальная|полная/typed-array/for-each
   core-js/es|стабильная|актуальная|полная/typed-array/from
   core-js/es|стабильная|актуальная|полная/typed-array/includes
   core-js/es|стабильная|актуальная|полная/typed-array/index-of
   core-js/es|стабильная|актуальная|полная/typed-array/iterator
   core-js/es|стабильная|актуальная|полная/typed-array/join
   core-js/es|стабильная|актуальная|полная/typed-array/keys
   core-js/es|стабильная|актуальная|полная/typed-array/last-index-of
   core-js/es|стабильная|актуальная|полная/typed-array/map
   core-js/es|стабильная|актуальная|полная/typed-array/of
   core-js/es|стабильная|актуальная|полная/typed-array/reduce
   core-js/es|стабильная|актуальная|полная/typed-array/reduce-right
   ```core-js/es|стабильная|актуальная|полная/typed-array/reverse
  core-js/es|стабильная|актуальная|полная/typed-array/set
 core-js/es|стабильная|актуальная|полная/typed-array/slice
 core-js/es|стабильная|актуальная|полная/typed-array/some
 core-js/es|стабильная|актуальная|полная/typed-array/sort
 core-js/es|стабильная|актуальная|полная/typed-array/subarray
 core-js/es|стабильная|актуальная|полная/typed-array/to-locale-string
 core-js/es|стабильная|актуальная|полная/typed-array/to-reversed
 core-js/es|стабильная|актуальная|полная/typed-array/to-sorted
 core-js/es|стабильная|актуальная|полная/typed-array/to-string
 core-js/es|стабильная|актуальная|полная/typed-array/values
 core-js/es|стабильная|актуальная|полная/typed-array/with
 ```
 [*Примеры*](https://tinyurl. com/23cdt8rk):
 ```js
 new Int32Array(4);                          // => [0, 0, 0, 0]
 new Uint8ClampedArray([1, 2, 3, 666]);      // => [1, 2, 3, 255]
 new Float32Array(new Set([1, 2, 3, 2, 1])); // => [1, 2, 3]```markdown
 Допустим `buffer = new ArrayBuffer(8);`
 Допустим `view = new DataView(buffer);`
 view.setFloat64(0, 123.456, true);
 new Uint8Array(buffer.slice(4)); // => [47, 221, 94, 64]Int8Array.of(1, 1.5, 5.7, 745);      // => [1, 1, 5, -23]
Uint8Array.from([1, 1.5, 5.7, 745]); // => [1, 1, 5, 233]

Допустим `typed = new Uint8Array([1, 2, 3]);`

Допустим `a = typed.slice(1);`    // => [2, 3]
typed.buffer === a.buffer; // => false
Допустим `b = typed.subarray(1);` // => [2, 3]
typed.buffer === b.buffer; // => true

typed.filter(it => it % 2); // => [1, 3]
typed.map(it => it * 1.5);  // => [1, 3, 4]

for (let value of typed) console.log(value);          // => 1, 2, 3
for (let value of typed.values()) console.log(value); // => 1, 2, 3
for (let key of typed.keys()) console.log(key);       // => 0, 1, 2
for (let [key, value] of typed.entries()) {
  console.log(key);                                   // => 0, 1, 2
  console.log(value);                                 // => 1, 2, 3
}

new Int32Array([1, 2, 3]).at(1);  // => 2
new Int32Array([1, 2, 3]).at(-1); // => 3

buffer = Int8Array.of(1, 2, 3, 4, 5, 6, 7, 8).buffer;
console.log(buffer.byteLength); // => 8
console.log(buffer.detached); // => false
const newBuffer = buffer.transfer(4);
console.log(buffer.byteLength); // => 0
console.log(buffer.detached); // => true
console.log(newBuffer.byteLength); // => 4
console.log(newBuffer.detached); // => false
console.log([...new Int8Array(newBuffer)]); // => [1, 2, 3, 4]> [!WARNING]
> - Полифиллы конструкторов Typed Arrays работают полностью так, как должны работать по спецификации. Однако из-за внутреннего использования геттеров/сеттеров на каждом экземпляре, они медленные и потребляют значительное количество памяти. Тем не менее, полифиллы конструкторов Typed Arrays требуются в основном для старого IE, все современные движки имеют встроенные конструкторы Typed Arrays и требуют только исправления конструкторов и полифиллы методов.
> - `ArrayBuffer.prototype.{transfer, transferToFixedLength}` полифиллы реализуются только в runtime с использованием встроенного `structuredClone` с поддержкой `ArrayBuffer` transfer или `MessageChannel`.

```#### ECMAScript: Reflect[⬆](#index)
Модули [`es.reflect.apply`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.apply.js), [`es.reflect.construct`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.construct.js), [`es.reflect.defineProperty`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.defineProperty.js), [`es.reflect.deleteProperty`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.deleteProperty.js), [`es.reflect.get`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get.js), [`es.reflect.getOwnPropertyDescriptor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.getOwnPropertyDescriptor.js), [`es.reflect.getPrototypeOf`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.getPrototypeOf.js), [`es.reflect.has`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.has.js), [`es.reflect.isExtensible`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.isExtensible.js), [`es.reflect.ownKeys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.ownKeys.js),
``````markdown
## Рефлексия

См. также: [`es.reflect.get-own-property-descriptor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get-own-property-descriptor.js), [`es.reflect.get-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get-prototype-of.js), [`es.reflect.set-prototype-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.set-prototype-of.js), [`es.reflect.apply`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.apply.js), [`es.reflect.construct`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.construct.js), [`es.reflect.delete-property`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.delete-property.js), [`es.reflect.get`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.get.js), [`es.reflect.set`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.set.js), [`es.reflect.has`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.has.js), [`es.reflect.is-extensible`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.is-extensible.js), [`es.reflect.own-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.own-keys.js), [`es.reflect.prevent-extensions`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.reflect.prevent-extensions.js).

```ts
namespace Reflect {
   apply(target: Function, thisArgument: any, argumentsList: Array<mixed>): any;
   construct(target: Function, argumentsList: Array<mixed>, newTarget? : Function): Object;
   defineProperty(target: Object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
   deleteProperty(target: Object, propertyKey: PropertyKey): boolean;
   get(target: Object, propertyKey: PropertyKey, receiver? : any): any;
   getOwnPropertyDescriptor(target: Object, propertyKey: PropertyKey): PropertyDescriptor | void;
   getPrototypeOf(target: Object): Object | null;
   has(target: Object, propertyKey: PropertyKey): boolean;
   isExtensible(target: Object): boolean;
}
``````javascript
Reflect.ownKeys(target: Object): Array<string | symbol>;
Reflect.preventExtensions(target: Object): boolean;
Reflect.set(target: Object, propertyKey: PropertyKey, V: any, receiver? : any): boolean;
Reflect.setPrototypeOf(target: Object, proto: Object | null): boolean; // required __proto__ - IE11+
```
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/reflect
core-js(-pure)/es|stable|actual|full/reflect/apply
core-js(-pure)/es|stable|actual|full/reflect/construct
core-js(-pure)/es|stable|actual|full/reflect/define-property
core-js(-pure)/es|stable|actual|full/reflect/delete-property
core-js(-pure)/es|stable|actual|full/reflect/get
core-js(-pure)/es|stable|actual|full/reflect/get-own-property-descriptor
core-js(-pure)/es|stable|actual|full/reflect/get-prototype-of
core-js(-pure)/es|stable|actual|full/reflect/has
core-js(-pure)/es|stable|actual|full/reflect/is-extensible
core-js(-pure)/es|stable|actual|full/reflect/own-keys
core-js(-pure)/es|stable|actual|full/reflect/prevent-extensions
core-js(-pure)/es|stable|actual|full/reflect/set
core-js(-pure)/es|stable|actual|full/reflect/set-prototype-of
```
[*Примеры*](https://tinyurl.com/27leplqz):
```javascript
let object = { a: 1 };
Object.defineProperty(object, 'b', { value: 2 });
object[Symbol('c')] = 3;
Reflect.ownKeys(object); // => ['a', 'b', Symbol(c)]
```
```
функция C(a, b) {
  this.c = a + b;
}

let instance = Reflect.construct(C, [20, 22]);
instance.c; // => 42
```

#### ECMAScript: JSON[⬆](#index)
Так как объект `JSON` отсутствует только в очень старых движках, таких как IE7-, `core-js` не предоставляет полный полифилл для `JSON`, однако исправляет уже существующие реализации в соответствии с текущим стандартом, например, [правильно сформированный `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify). `JSON` также исправляется в других модулях - например, полифилл для `Symbol` исправляет `JSON.stringify` для корректной работы с символами.Модуль [`es.json.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.json.to-string-tag.js) и [`es.json.stringify`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.json.stringify.js).
```ts
namespace JSON {
  stringify(value: any, replacer?: Array<string | number> | ((this: any, key: string, value: any) => any), space?: string | number): string | void;
  @@toStringTag: 'JSON';
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/json/stringify
core-js(-pure)/es|stable|actual|full/json/to-string-tag
```
[*Примеры*](https://is.gd/izZqKn):
```js
JSON.stringify({ '𠮷': ['\\uDF06\\uD834'] }); // => '{"𠮷":["\\\\udf06\\\\ud834"]}'
```

#### ECMAScript: globalThis[⬆](#index)
Модуль [`es.global-this`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.global-this.js).
```ts
let globalThis: GlobalThisValue;
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/es|stable|actual|full/global-this
```
[*Примеры*](https://tinyurl.com/25ajyfuk):
```js
globalThis.Array === Array; // => true
```

### ECMAScript предложения[⬆](#index)
[Процесс TC39.](https://tc39.github.io/process-document/)

`core-js/stage/3` содержит только предложения стадии 3, `core-js/stage/2.7` - предложения стадии 2.7 и стадии 3, и т.д.

#### Завершенные предложения[⬆](#index)Завершенные (стадия 4) предложения уже отмечены в `core-js` как стабильные части ECMAScript, они доступны в `core-js/stable` и `core-js/es` пространстве имен, вы можете найти их в соответствующих разделах README. Однако, даже для завершенных предложений, `core-js` предоставляет возможность включать только функции для конкретного предложения, например `core-js/proposals/proposal-name`.

##### [`globalThis`](https://github.com/tc39/proposal-global)[⬆](#index)
```ts
let globalThis: GlobalThisValue;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/global-this
```
##### [Метод индексации относительно](https://github.com/tc39/proposal-relative-indexing-method)[⬆](#index)
```ts
class Array {
  at(index: int): any;
}
```class String {
  at(index: int): string;
}

class %TypedArray% {
  at(index: int): number;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/relative-indexing-method
```
##### [`Array.prototype.includes`](https://github.com/tc39/proposal-Array.prototype.includes)[⬆](#index)
```ts
class Array {
  includes(searchElement: any, from?: number): boolean;
}

class %TypedArray% {
  includes(searchElement: any, from?: number): boolean;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-includes
```
##### [`Array.prototype.flat` / `Array.prototype.flatMap`](https://github.com/tc39/proposal-flatMap)[⬆](#index)
```ts
class Array {
  flat(depthArg?: number = 1): Array<mixed>;
  flatMap(mapFn: (value: any, index: number, target: any) => any, thisArg: any): Array<mixed>;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-flat-map
```
##### [Поиск в массиве с конца](https://github.com/tc39/proposal-array-find-from-last)[⬆](#index)
```ts
class Array {
  findLast(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): any;
  findLastIndex(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): uint;
}
``````markdown
class %TypedArray% {
  findLast(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): any;
  findLastIndex(callbackfn: (value: any, index: number, target: %TypedArray%) => boolean, thisArg?: any): uint;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-find-from-last
```
##### [Изменение `Array` путем копирования](https://github.com/tc39/proposal-change-array-by-copy)[⬆](#index)
```ts
class Array {
  toReversed(): Array<mixed>;
  toSpliced(start?: number, deleteCount?: number, ...items: Array<mixed>): Array<mixed>;
  toSorted(comparefn?: (a: any, b: any) => number): Array<mixed>;
  with(index: includes, value: any): Array<mixed>;
}
```
```markdown
class %TypedArray% {
  toReversed(): %TypedArray%;
  toSorted(comparefn?: (a: any, b: any) => number): %TypedArray%;
  with(index: includes, value: any): %TypedArray%;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/change-array-by-copy-stage-4
core-js(-pure)/es|stable|actual|full/array(/virtual)/to-reversed
core-js(-pure)/es|stable|actual|full/array(/virtual)/to-sorted
core-js(-pure)/es|stable|actual|full/array(/virtual)/to-spliced
core-js(-pure)/es|stable|actual|full/array(/virtual)/with
core-js/es|stable|actual|full/typed-array/to-reversed
core-js/es|stable|actual|full/typed-array/to-sorted
core-js/es|stable|actual|full/typed-array/with
```
##### [`Array` группировка](https://github.com/tc39/proposal-array-grouping)[⬆](#index)
```ts
class Object {
  static groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): { [key]: Array<mixed> };
}
```class Map {
  static groupBy(items: Iterable, callbackfn: (value: any, index: number) => key): Map<key, Array<mixed>>;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-grouping-v2
```

##### [`ArrayBuffer.prototype.transfer` и методы](https://github.com/tc39/proposal-arraybuffer-transfer)[⬆](#index)
```ts
class ArrayBuffer {
  readonly attribute detached: boolean;
  transfer(newLength?: number): ArrayBuffer;
  transferToFixedLength(newLength?: number): ArrayBuffer;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-buffer-transfer
```

##### [`Float16` методы](https://github.com/tc39/proposal-float16array)[⬆](#index)
```ts
class DataView {
  getFloat16(offset: any, littleEndian?: boolean = false): float16;
  setFloat16(offset: any, value: any, littleEndian?: boolean = false): void;
}
```namespace Math {
   fround(number: any): number;
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/float16
 ```##### [`Iterator` helpers](https://github.com/tc39/proposal-iterator-helpers)[⬆](#index)
 ```ts
 class Iterator {
   static from(iterable: Iterable<any> | Iterator<any>): Iterator<any>;
   drop(limit: uint): Iterator<any>;
   every(callbackfn: (value: any, counter: uint) => boolean): boolean;
   filter(callbackfn: (value: any, counter: uint) => boolean): Iterator<any>;
   find(callbackfn: (value: any, counter: uint) => boolean): any;
   flatMap(callbackfn: (value: any, counter: uint) => Iterable<any> | Iterator<any>): Iterator<any>;
   forEach(callbackfn: (value: any, counter: uint) => void): void;
   map(callbackfn: (value: any, counter: uint) => any): Iterator<any>;
   reduce(callbackfn: (memo: any, value: any, counter: uint) => any, initialValue: any): any;
   some(callbackfn: (value: any, counter: uint) => boolean): boolean;
   take(limit: uint): Iterator<any>;
   toArray(): Array<any>;
   @@toStringTag: 'Iterator'
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/iterator-helpers-stage-3-2
 ```##### [`Object.values` / `Object.entries`](https://github.com/tc39/proposal-object-values-entries)[⬆](#index)
 ```ts
 class Object {
   static entries(object: Object): Array<[string, mixed]>;
   static values(object: any): Array<mixed>;
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/object-values-entries
 ```
 ##### [`Object.fromEntries`](https://github.com/tc39/proposal-object-from-entries)[⬆](#index)
 ```ts
 class Object {
   static fromEntries(iterable: Iterable<[key, value]>): Object;
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/object-from-entries
 ```
 ##### [`Object.getOwnPropertyDescriptors`](https://github.com/tc39/proposal-object-getownpropertydescriptors)[⬆](#index)
 ```ts
 class Object {
   static getOwnPropertyDescriptors(object: any): { [property: PropertyKey]: PropertyDescriptor };
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/object-getownpropertydescriptors
 ```
 ##### [Доступный `Object.prototype.hasOwnProperty`](https://github.com/tc39/proposal-accessible-object-hasownproperty)[⬆](#index)
 ```ts
 class Object {
   static hasOwn(object: object, key: PropertyKey): boolean;
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/object-hasown
 ```core-js/proposals/accessible-object-hasownproperty
 ```
##### [`String` padding](https://github.com/tc39/proposal-string-pad-start-end)[⬆](#index)
```ts
class String {
  padStart(length: number, fillStr?: string = ' '): string;
  padEnd(length: number, fillStr?: string = ' '): string;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/string-padding
```
##### [`String#matchAll`](https://github.com/tc39/proposal-string-matchall)[⬆](#index)
```ts
class String {
  matchAll(regexp: RegExp): Iterator;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/string-match-all
```
##### [`String#replaceAll`](https://github.com/tc39/proposal-string-replace-all)[⬆](#index)
```ts
class String {
  replaceAll(searchValue: string | RegExp, replaceString: string | (searchValue, index, this) => string): string;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/string-replace-all-stage-4
```
##### [`String.prototype.trimStart` / `String.prototype.trimEnd`](https://github.com/tc39/proposal-string-left-right-trim)[⬆](#index)
```ts
class String {
  trimLeft(): string;
  trimRight(): string;
  trimStart(): string;
  trimEnd(): string;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/string-left-right-trim
```
##### [`RegExp` `s` (`dotAll`) flag](https://github.com/tc39/proposal-regexp-dotall-flag)[⬆](#index)
```ts
// исправлен для поддержки `RegExp` dotAll (`s`) флага:
class RegExp {
  constructor(pattern: RegExp | string, flags?: string): RegExp;
  exec(): Array<string | undefined> | null;
  readonly attribute dotAll: boolean;
  readonly attribute flags: string;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/regexp-dotall-flag
```
##### [`RegExp` именованные захваченные группы](https://github.com/tc39/proposal-regexp-named-groups)[⬆](#index)
```ts
// исправлен для поддержки `RegExp` именованных захваченных групп:
class RegExp {
  constructor(pattern: RegExp | string, flags?: string): RegExp;
  exec(): Array<string | undefined> | null;
  @@replace(string: string, replaceValue: Function | string): string;
}
```[*CommonJS вступительные точки:*](#commonjs-api)
 ```
 core-js/proposals/regexp-named-groups
 ```
##### [`RegExp` экранирование](https://github.com/tc39/proposal-regex-escaping)[⬆](#index)
 ```ts
 class RegExp {
   static escape(value: string): string
 }
 ```
 [*CommonJS вступительные точки:*](#commonjs-api)
 ```
 core-js/proposals/regexp-escaping
 ```##### [`Promise.allSettled`](https://github.com/tc39/proposal-promise-allSettled)[⬆](#index)
```ts
class Promise {
  static allSettled(iterable: Iterable): Promise;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/promise-all-settled
```
##### [`Promise.any`](https://github.com/tc39/proposal-promise-any)[⬆](#index)
```ts
class AggregateError {
  constructor(errors: Iterable, message: string): AggregateError;
  errors: Array<any>;
  message: string;
}

class Promise {
  static any(promises: Iterable): Promise<any>;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/promise-any
```
##### [`Promise.prototype.finally`](https://github.com/tc39/proposal-promise-finally)[⬆](#index)
```ts
class Promise {
  finally(onFinally: Function): Promise;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/promise-finally
```##### [`Promise.try`](https://github.com/tc39/proposal-promise-try)
```ts
class Promise {
  static try(callbackfn: Function, ...args?: Array<mixed>): Promise;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/promise-try
```
##### [`Promise.withResolvers`](https://github.com/tc39/proposal-promise-with-resolvers)[⬆](#index)
```ts
class Promise {
  static withResolvers(): { promise: Promise, resolve: Function, reject: Function };
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/promise-with-resolvers
```
##### [`Symbol.asyncIterator` для асинхронного итерирования](https://github.com/tc39/proposal-async-iteration)[⬆](#index)
```ts
class Symbol {
  static asyncIterator: @@asyncIterator;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/async-iteration
```
##### [`Symbol.prototype.description`](https://github.com/tc39/proposal-Symbol-description)[⬆](#index)
```ts
class Symbol {
  readonly attribute description: string | void;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/symbol-description
```
##### [Корректная `JSON.stringify`](https://github.com/tc39/proposal-well-formed-stringify)[⬆](#index)
```ts
namespace JSON {
  stringify(target: any, replacer?: Function | Array, space?: string | number): string | void;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/well-formed-stringify
```
##### [Корректные юникодные строки](https://github.com/tc39/proposal-is-usv-string)[⬆](#index)
```ts
class String {
  isWellFormed(): boolean;
  toWellFormed(): string;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/well-formed-unicode-strings
```
##### [Новые методы `Set`](https://github.com/tc39/proposal-set-methods)[⬆](#index)
```ts
class Set {
  difference(other: SetLike<mixed>): Set;
  intersection(other: SetLike<mixed>): Set;
  isDisjointFrom(other: SetLike<mixed>): boolean;
  isSubsetOf(other: SetLike<mixed>): boolean;
  isSupersetOf(other: SetLike<mixed>): boolean;
  symmetricDifference(other: SetLike<mixed>): Set;
  union(other: SetLike<mixed>): Set;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/set-methods-v2
```
#### Предложения для Stage 3[⬆](#index)[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stage/3
```
##### [`Array.fromAsync`](https://github.com/tc39/proposal-array-from-async)[⬆](#index)
Модули [`esnext.array.from-async`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.from-async.js).
```ts
class Array {
  static fromAsync(asyncItems: AsyncIterable | Iterable | ArrayLike, mapfn?: (value: any, index: number) => any, thisArg?: any): Array;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/array-from-async-stage-2
core-js(-pure)/actual|full/array/from-async
```
[*Пример*](https://tinyurl.com/2bt9bhwn):
```js
await Array.fromAsync((async function * () { yield * [1, 2, 3]; })(), it => it ** 2); // => [1, 4, 9]
```

##### [`JSON.parse` доступ к исходному тексту](https://github.com/tc39/proposal-json-parse-with-source)[⬆](#index)
Модули [`esnext.json.is-raw-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.is-raw-json.js), [`esnext.json.parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.parse.js), [`esnext.json.raw-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.json.raw-json.js).
```ts
namespace JSON {
  isRawJSON(O: any): boolean;
  // отредактировано для поддержки источника
  parse(text: string, reviver?: (this: any, key: string, value: any, context: { source?: string }) => any): any;
  rawJSON(text: any): RawJSON;
  // отредактировано для поддержки `JSON.rawJSON`
  stringify(value: any, replacer?: Array<string | number> | (this: any, key: string, value: any) => any, space?: string | number): string | void;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/json-parse-with-source
core-js(-pure)/actual|full/json/is-raw-json
core-js(-pure)/actual|full/json/parse
core-js(-pure)/actual|full/json/raw-json
core-js(-pure)/actual|full/json/stringify
```
[*Примеры*](https://tinyurl.com/22phm569):
```js
function digitsToBigInt(key, val, { source }) {
  return /^\\d+$/.test(source) ? BigInt(source) : val;
}

function bigIntToRawJSON(key, val) {
  return typeof val === 'bigint' ? JSON.rawJSON(String(val)) : val;
}
``````md
const слишкомБольшое = BigInt(`1${ '0'.repeat(1000) }`);
JSON.parse(String(слишкомБольшое), digitsToBigInt) === слишкомБольшое; // true

const встроенный = JSON.stringify({ слишкомБольшоеДляЧисла: BigInt(Number.MAX_SAFE_INTEGER) + 2n }, bigIntToRawJSON);
встроенный === '{"слишкомБольшоеДляЧисла":9007199254740993}'; // true
```##### [`Uint8Array` в base64 и hex и обратно](https://github.com/tc39/proposal-arraybuffer-base64)[⬆](#index)
Модули [`esnext.uint8-array.from-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-base64.js), [`esnext.uint8-array.from-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.from-hex.js), [`esnext.uint8-array.set-from-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.set-from-hex.js), [`esnext.uint8-array.to-base64`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-base64.js), [`esnext.uint8-array.to-hex`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.uint8-array.to-hex.js).
```ts
class Uint8Array {
  static fromBase64(строка: string, опции? : { алфавит? : 'base64' | 'base64url', обработкаПоследнегоБлока? : 'loose' | 'strict' | 'stop-before-partial' }): Uint8Array;
  static fromHex(строка: string): Uint8Array;
  setFromBase64(строка: string, опции? : { алфавит? : 'base64' | 'base64url', обработкаПоследнегоБлока? : 'loose' | 'strict' | 'stop-before-partial' }): { прочитано: uint, записано: uint };
  setFromHex(строка: string): { прочитано: uint, записано: uint };
  toBase64(опции? : { алфавит? : 'base64' | 'base64url', опусканиеЗаполнения? : boolean }): string;
  toHex(): string;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/array-buffer-base64
core-js(-pure)/actual|full/typed-array/from-base64
core-js(-pure)/actual|full/typed-array/from-hex
core-js(-pure)/actual|full/typed-array/set-from-base64
core-js(-pure)/actual|full/typed-array/set-from-hex
core-js(-pure)/actual|full/typed-array/to-base64
core-js(-pure)/actual|full/typed-array/to-hex
```
*Пример*:
```js
let arr = new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
console.log(arr.toBase64()); // => 'SGVsbG8gV29ybGQ='
console.log(arr.toBase64({ omitPadding: true })); // => 'SGVsbG8gV29ybGQ'
console.log(arr.toHex()); // => '48656c6c6f20576f726c64'
console.log(Uint8Array.fromBase64('SGVsbG8gV29ybGQ=')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
``````markdown
console.log(Uint8Array.fromHex('48656c6c6f20576f726c64')); // => Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])
```

##### [Ясное управление ресурсами](https://github.com/tc39/proposal-explicit-resource-management)[⬆](#index)
> [!NOTE]
> Это только встроенные объекты для этого предложения, поддержка синтаксиса `using` требует поддержки транспилятором.
```Модули [`esnext.symbol.dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.dispose.js), [`esnext.disposable-stack.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.disposable-stack.constructor.js), [`esnext.suppressed-error.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.suppressed-error.constructor.js), [`esnext.iterator.dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.dispose.js), [`esnext.symbol.async-dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.async-dispose.js), [`esnext.async-disposable-stack.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-disposable-stack.constructor.js), [`esnext.async-iterator.async-dispose`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.async-dispose.js).
```ts
class Symbol {
  static asyncDispose: @@asyncDispose;
  static dispose: @@dispose;
}

class DisposableStack {
  constructor(): DisposableStack;
  dispose(): void;
  use(value: Disposable): value;
  adopt(value: object, onDispose: Function): value;
  defer(onDispose: Function): void;
  move(): DisposableStack;
  @@dispose(): void;
  @@toStringTag: 'DisposableStack';
}

class AsyncDisposableStack {
  constructor(): AsyncDisposableStack;
  disposeAsync(): Promise<void>;
  use(value: AsyncDisposable | Disposable): value;
  adopt(value: object, onDispose: Function): value;
  defer(onDispose: Function): void;
  move(): AsyncDisposableStack;
  @@asyncDispose(): Promise<void>;
  @@toStringTag: 'AsyncDisposableStack';
}

class SuppressedError extends Error {
  constructor(error: any, suppressed: any, message?: string): SuppressedError;
  error: any;
  suppressed: any;
  message: string;
  cause: any;
}
``````javascript
class Iterator {
  @@dispose(): undefined;
}
```

```javascript
class AsyncIterator {
  @@asyncDispose(): Promise<undefined>;
}
```

[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/explicit-resource-management
core-js(-pure)/actual|full/symbol/async-dispose
core-js(-pure)/actual|full/symbol/dispose
core-js(-pure)/actual|full/disposable-stack
core-js(-pure)/actual|full/async-disposable-stack
core-js(-pure)/actual|full/suppressed-error
core-js(-pure)/actual|full/iterator/dispose
core-js(-pure)/actual|full/async-iterator/async-dispose
```

Модуль [`esnext.math.sum-precise`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.sum-precise.js)
```typescript
class Math {
  static sumPrecise(items: Iterable<number>): Number;
}
```

[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/math-sum
core-js(-pure)/full|actual/math/sum-precise
```

[*Примеры*](https://tinyurl.com/2bd3nako):
```javascript
1e20 + 0.1 + -1e20; // => 0
Math.sumPrecise([1e20, 0.1, -1e20]); // => 0.1
```##### [`Symbol.metadata` для предложений метаданных декораторов](https://github.com/tc39/proposal-decorator-metadata)[⬆](#index)
Модули [`esnext.symbol.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.metadata.js) и [`esnext.function.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.metadata.js).
```ts
class Symbol {
  static metadata: @@metadata;
}

class Function {
  @@metadata: null;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/decorator-metadata-v2
core-js(-pure)/actual|full/symbol/metadata
core-js(-pure)/actual|full/function/metadata
```

##### [`Error.isError`](https://github.com/tc39/proposal-is-error)[⬆](#index)
Модуль [`esnext.error.is-error`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.error.is-error.js)
```ts
class Error {
  static isError(value: any): boolean;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/is-error
core-js(-pure)/actual|full/error/is-error
```
[*Пример*](https://tinyurl.com/23nauwoz):
```js
Error.isError(new Error('error')); // => true
Error.isError(new TypeError('error')); // => true
Error.isError(new DOMException('error')); // => true

Error.isError(null); // => false
Error.isError({}); // => false
Error.isError(Object.create(Error.prototype)); // => false
```

> [!WARNING]
> У нас нет надежного способа полифилла этого метода / проверки, является ли объект ошибкой, поэтому это достаточно наивная реализация.#### Предложения стадии 2.7[⬆](#index)
[*CommonJS entry points:*](#commonjs-api)
```
core-js(-pure)/stage/2.7
```
##### [`Последовательность` итератора](https://github.com/tc39/proposal-iterator-sequencing)[⬆](#index)
Модуль [`esnext.iterator.concat`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.concat.js)
```ts
class Iterator {
  concat(...items: Array<IterableObject>): Iterator<any>;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/iterator-sequencing
core-js(-pure)/full/iterator/concat
```
[*Пример*](https://tinyurl.com/2522xjae):
```js
Iterator.concat([0, 1].values(), [2, 3], function * () {
  yield 4;
  yield 5;
}()).toArray(); // => [0, 1, 2, 3, 4, 5]
```
##### [`Map` upsert](https://github.com/thumbsupep/proposal-upsert)[⬆](#index)
Модули [`esnext.map.get-or-insert`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.get-or-insert.js), [`esnext.map.get-or-insert-computed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.get-or-insert-computed.js), [`esnext.weak-map.get-or-insert`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.get-or-insert.js) и [`esnext.weak-map.get-or-insert-computed`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.get-or-insert-computed.js)
```ts
class Map {
  getOrInsert(key: any, value: any): any;
  getOrInsertComputed(key: any, (key: any) => value: any): any;
}
```class WeakMap {
  getOrInsert(key: any, value: any): any;
  getOrInsertComputed(key: any, (key: any) => value: any): any;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/map-upsert-v4
core-js(-pure)/full/map/get-or-insert
core-js(-pure)/full/map/get-or-insert-computed
core-js(-pure)/full/weak-map/get-or-insert
core-js(-pure)/full/weak-map/get-or-insert-computed
```
[*Примеры*](https://tinyurl.com/2a54u5ux):
```js
const map = new Map([['a', 1]]);

map.getOrInsert('a', 2); // => 1

map.getOrInsert('b', 3); // => 3

map.getOrInsertComputed('a', key => key); // => 1

map.getOrInsertComputed('c', key => key); // => 'c'
``````markdown
console.log(map); // => Map { 'a': 1, 'b': 3, 'c': 'c' }
```#### Предложения для Stage 2[⬆](#index)
 [*CommonJS точки входа:*](#commonjs-api)
 ```
core-js(-pure)/stage/2
```
##### [`AsyncIterator` вспомогательные функции](https://github.com/tc39/proposal-async-iterator-helpers)[⬆](#index)
Модули [`esnext.async-iterator.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.constructor.js), [`esnext.async-iterator.drop`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.drop.js), [`esnext.async-iterator.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.every.js), [`esnext.async-iterator.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.filter.js), [`esnext.async-iterator.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.find.js), [`esnext.async-iterator.flatMap`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.flatMap.js), [`esnext.async-iterator.forEach`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.forEach.js), [`esnext.async-iterator.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.from.js), [`esnext.async-iterator.map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.map.js), [`esnext.async-iterator.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.reduce.js), [`esnext.async-iterator.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.some.js), [`esnext.async-iterator.take`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.take.js), [`esnext.async-iterator.toArray`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.async-iterator.toArray.js), , [`esnext.iterator.toAsync`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.toAsync.js)
```ts
class Iterator {
  toAsync(): AsyncIterator<any>;
}
```
```markdown
class AsyncIterator {
```  static from(последовательный: AsyncIterable<any> | Iterable<any> | AsyncIterator<any>): AsyncIterator<any>;
   drop(лимит: number): AsyncIterator<any>;
   every(async callbackfn: (значение: any, счетчик: number) => boolean): Promise<boolean>;
   filter(async callbackfn: (значение: any, счетчик: number) => boolean): AsyncIterator<any>;
   find(async callbackfn: (значение: any, счетчик: number) => boolean): Promise<any>;
   flatMap(async callbackfn: (значение: any, счетчик: number) => AsyncIterable<any> | Iterable<any> | AsyncIterator<any>): AsyncIterator<any>;
   forEach(async callbackfn: (значение: any, счетчик: number) => void): Promise<void>;
   map(async callbackfn: (значение: any, счетчик: number) => any): AsyncIterator<any>;
   reduce(async callbackfn: (memo: any, значение: any, счетчик: number) => any, начальное_значение: any): Promise<any>;
   some(async callbackfn: (значение: any, счетчик: number) => boolean): Promise<boolean>;
   take(лимит: number): AsyncIterator<any>;
   toArray(): Promise<Array<any>>;
   @@toStringTag: 'AsyncIterator'
 }
 ```
 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/async-iterator-helpers
 core-js(-pure)/actual|full/async-iterator
 core-js(-pure)/actual|full/async-iterator/drop
 core-js(-pure)/actual|full/async-iterator/every
 core-js(-pure)/actual|full/async-iterator/filter
 core-js(-pure)/actual|full/async-iterator/find
 core-js(-pure)/actual|full/async-iterator/flat-map
 core-js(-pure)/actual|full/async-iterator/for-each
 core-js(-pure)/actual|full/async-iterator/from
 core-js(-pure)/actual|full/async-iterator/map
 core-js(-pure)/actual|full/async-iterator/reduce
 core-js(-pure)/actual|full/async-iterator/some
 core-js(-pure)/actual|full/async-iterator/take
 core-js(-pure)/actual|full/async-iterator/to-array
 core-js(-pure)/actual|full/iterator/to-async
 ```
 [Примеры](https://tinyurl.com/28tet4ek):
 ```js
 await AsyncIterator.from([1, 2, 3, 4, 5, 6, 7])
   .drop(1)
   .take(5)
   .filter(it => it % 2)
   .map(it => it ** 2)
   .toArray(); // => [9, 25]
 ```await [1, 2, 3].values().toAsync().map(async it => it ** 2).toArray(); // => [1, 4, 9]
```###### Внимание:[⬆](#index)
- Для предотвращения загрязнения прототипов, в версии `pure`, новые методы `%AsyncIteratorPrototype%` не добавляются к настоящему `%AsyncIteratorPrototype%`, они доступны только на обёртках — вместо `[].values().toAsync().map(fn)` используйте `AsyncIterator.from([]).map(fn)`.
- Теперь, мы имеем доступ к настоящему `%AsyncIteratorPrototype%` только с использованием синтаксиса асинхронных генераторов. Поэтому, для обеспечения совместимости библиотеки со старыми браузерами, следует использовать конструктор `Function`. Однако, это нарушает совместимость с CSP. Так что, если вы хотите использовать настоящий `%AsyncIteratorPrototype%`, вам следует установить опцию `USE_FUNCTION_CONSTRUCTOR` в `core-js/configurator` на `true`:
```js
const configurator = require('core-js/configurator');

configurator({ USE_FUNCTION_CONSTRUCTOR: true });

require('core-js/actual/async-iterator');

(async function * () { /* пустое */ })() instanceof AsyncIterator; // => true
```
- В качестве альтернативы вы можете передать объект в `core-js/configurator`, который будет рассматриваться как `%AsyncIteratorPrototype%`:
```js
const configurator = require('core-js/configurator');

const { getPrototypeOf } = Object;

configurator({ AsyncIteratorPrototype: getPrototypeOf(getPrototypeOf(getPrototypeOf(async function * () { /* пустое */ }()))) });

require('core-js/actual/async-iterator');

(async function * () { /* пустое */ })() instanceof AsyncIterator; // => true
```##### [`Iterator.range`](https://github.com/tc39/proposal-Number.range)[⬆](#index)
Модуль [`esnext.iterator.range`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.iterator.range.js)
```ts
class Iterator {
  range(start: number, end: number, options: { step: number = 1, inclusive: boolean = false } | step: number = 1): NumericRangeIterator;
  range(start: bigint, end: bigint | Infinity | -Infinity, options: { step: bigint = 1n, inclusive: boolean = false } | step: bigint = 1n): NumericRangeIterator;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/number-range
core-js(-pure)/full/iterator/range
```
[*Пример*](https://tinyurl.com/2gobe777):
```js
for (const i of Iterator.range(1, 10)) {
  console.log(i); // => 1, 2, 3, 4, 5, 6, 7, 8, 9
}
```for (const i of Iterator.range(1, 10, { step: 3, inclusive: true })) {
  console.log(i); // => 1, 4, 7, 10
}
```##### [`Array.isTemplateObject`](https://github.com/tc39/proposal-array-is-template-object)[⬆](#index)
Модуль [`esnext.array.is-template-object`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.is-template-object.js)
```ts
class Array {
  static isTemplateObject(value: any): boolean
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-is-template-object
core-js(-pure)/full/array/is-template-object
```
*Пример*:
```js
console.log(Array.isTemplateObject((it => it)`qwe${ 123 }asd`)); // => true
```
##### [`String.dedent`](https://github.com/tc39/proposal-string-dedent)[⬆](#index)
Модуль [`esnext.string.dedent`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.dedent.js)
```ts
class String {
  static dedent(templateOrTag: { raw: Array<string> } | function, ...substitutions: Array<string>): string | function;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/string-dedent
core-js(-pure)/full/string/dedent
```
[*Пример*](https://tinyurl.com/2lbnofgo):
```js
const message = 42;
```
```md
console.log(String.dedent`
  вывод('${ message }')
`); // => вывод('42')

String.dedent(console.log)`
  вывод('${ message }')
`; // => ["вывод('", "')", raw: Array(2)], 42
```

##### [`Symbol` предикаты](https://github.com/tc39/proposal-symbol-predicates)[⬆](#index)
Модули [`esnext.symbol.is-registered-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-registered-symbol.js), [`esnext.symbol.is-well-known-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.is-well-known-symbol.js).
```ts
class Symbol {
  static isRegisteredSymbol(value: any): boolean;
  static isWellKnownSymbol(value: any): boolean;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/symbol-predicates-v2
core-js(-pure)/full/symbol/is-registered-symbol
core-js(-pure)/full/symbol/is-well-known-symbol
```
[*Пример*](https://tinyurl.com/2oqoaq7t):
```js
Symbol.isRegisteredSymbol(Symbol.for('key')); // => true
Symbol.isRegisteredSymbol(Symbol('key')); // => false
```Symbol.isWellKnownSymbol(Symbol.iterator); // => true
Symbol.isWellKnownSymbol(Symbol('key')); // => false
```

##### [`Symbol.customMatcher` для извлечений](https://github.com/tc39/proposal-extractors)[⬆](#index)
Модуль [`esnext.symbol.custom-matcher`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.custom-matcher.js).
```ts
class Symbol {
  static customMatcher: @@customMatcher;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/pattern-extractors
core-js(-pure)/full/symbol/custom-matcher
```#### Этап 1 предложений[⬆](#index)
 [*CommonJS точки входа:*](#commonjs-api)
 ```
 core-js(-pure)/stage/1
 ```
 ##### [`Observable`](https://github.com/zenparsing/es-observable)[⬆](#index)
 Модули [`esnext. observable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. observable. js) и [`esnext. symbol. observable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. symbol. observable. js)
 ```ts
 class Observable {
   constructor(subscriber: Function): Observable;
   subscribe(observer: Function | { next? : Function, error? : Function, complete? : Function }): Subscription;
   @@observable(): this;
   static of(... items: Array<mixed>): Observable;
   static from(x: Observable | Iterable): Observable;
   static readonly attribute @@species: this;
 }
 ```

 [*CommonJS entry points:*](#commonjs-api)
 ```
 core-js/proposals/observable
 core-js(-pure)/full/observable
 core-js(-pure)/full/symbol/observable
 ```
 *Пример*:
 ```js
 new Observable(observer => {
   observer.next('hello');
   observer.next('world');
   observer.complete();
 }).subscribe({
   next(it) { console.log(it); },
   complete() { console.log('!'); },
 });
 ```
 ##### [Новые методы для коллекций](https://github.com/tc39/proposal-collection-methods)[⬆](#index)
 Модули [`esnext. set. add-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. add-all. js), [`esnext. set. delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. delete-all. js), [`esnext. set. every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. every. js), [`esnext. set. filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. filter. js), [`esnext. set. find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. find. js), [`esnext. set. join`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. join. js), [`esnext. set. map`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. map. js), [`esnext. set. reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. reduce. js), [`esnext. set. some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext. set. some. js)some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.some.js), [`esnext.map.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.delete-all.js), [`esnext.map.every`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.every.js), [`esnext.map.filter`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.filter.js), [`esnext.map.find`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.find.js), [`esnext.map.find-key`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.find-key.js), [`esnext.map.includes`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.includes.js), [`esnext.map.key-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.key-by.js),
  ```com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.key-by.js), [`esnext.map.key-of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.key-of.js), [`esnext.map.map-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.map-keys.js), [`esnext.map.map-values`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.map-values.js), [`esnext.map.merge`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.merge.js), [`esnext.map.reduce`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.reduce.js), [`esnext.map.some`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.some.js), [`esnext.map.update`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.update.js), [`esnext.weak-set.add-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.add-all.js), [`esnext.weak-set.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.delete-all.js), [`esnext.weak-map.delete-all`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.delete-all.js)
  ##### [`.of` и `.from` методы на конструкторах коллекций](https://github.com/tc39/proposal-setmap-offrom)[⬆](#index)

Модули [`esnext.set.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.of.js), [`esnext.set.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.set.from.js), [`esnext.map.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.of.js), [`esnext.map.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.map.from.js), [`esnext.weak-set.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.of.js), [`esnext.weak-set.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-set.from.js), [`esnext.weak-map.of`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.of.js), [`esnext.weak-map.from`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.weak-map.from.js)

```ts
class Множество {
  static из(... args: Array<мешанина>): Множество;
  static изИтерируемого(iterable: Итерируемый<мешанина>, mapFn?: (value: any, index: number) => any, thisArg?: any): Множество;
  добавитьВсе(... args: Array<мешанина>): this;
  удалитьВсе(... args: Array<мешанина>): boolean;
  каждый(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean;
  фильтр(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): Множество;
  найти(callbackfn: (value: any, key: any, target: any) => boolean), thisArg?: any): any;
  соединить(separator: string = ','): string;
  отображение(callbackfn: (value: any, key: any, target: any) => any, thisArg?: any): Множество;
  свести(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue?: any): any;
  некоторые(callbackfn: (value: any, key: any, target: any) => boolean, thisArg?: any): boolean;
}
```

```markdown
class Map {
  static of(... args: Array<[key, value]>): Map;
  static from(iterable: Iterable<mixed>, mapFn?: (value: any, index: number) => any, thisArg?: any): Map;
}
```: (value: any, index: number) => [key: any, value: any], thisArg? : any): Map;
   static keyBy(iterable: Iterable<mixed>, callbackfn? : (value: any) => any): Map;
   deleteAll(. . . args: Array<mixed>): boolean;
   every(callbackfn: (value: any, key: any, target: any) => boolean, thisArg? : any): boolean;
   filter(callbackfn: (value: any, key: any, target: any) => boolean, thisArg? : any): Map;
   find(callbackfn: (value: any, key: any, target: any) => boolean, thisArg? : any): any;
   findKey(callbackfn: (value: any, key: any, target: any) => boolean, thisArg? : any): any;
   includes(searchElement: any): boolean;
   keyOf(searchElement: any): any;
   mapKeys(mapFn: (value: any, index: number, target: any) => any, thisArg? : any): Map;
   mapValues(mapFn: (value: any, index: number, target: any) => any, thisArg? : any): Map;
   merge(. . . iterables: Array<Iterable>): this;
   reduce(callbackfn: (memo: any, value: any, key: any, target: any) => any, initialValue? : any): any;
   some(callbackfn: (value: any, key: any, target: any) => boolean, thisArg? : any): boolean;
   update(key: any, callbackfn: (value: any, key: any, target: any) => any, thunk? : (key: any, target: any) => any): this;
 }class WeakSet {
   static of(... args: Array<mixed>): WeakSet;
   static from(iterable: Iterable<mixed>, mapFn? : (value: any, index: number) => Object, thisArg? : any): WeakSet;
   addAll(... args: Array<mixed>): this;
   deleteAll(... args: mixed[]): boolean;
 }
 ``````markdown
 ## Класс WeakMap
 ```javascript
 class WeakMap {
   static of(... args: Array<[key, value]>): WeakMap;
   static from(iterable: Iterable<mixed>, mapFn? : (value: any, index: number) => [key: Object, value: any], thisArg? : any): WeakMap;
   deleteAll(... args: mixed[]): boolean;
 }
 ```
 ```
 [*CommonJS точки входа:*](#commonjs-api)
 ```
 core-js/proposals/collection-methods
 core-js/proposals/collection-of-from
 core-js(-pure)/full/set/add-all
 core-js(-pure)/full/set/delete-all
 core-js(-pure)/full/set/every
 core-js(-pure)/full/set/filter
 core-js(-pure)/full/set/find
 core-js(-pure)/full/set/from
 core-js(-pure)/full/set/join
 core-js(-pure)/full/set/map
 core-js(-pure)/full/set/of
 core-js(-pure)/full/set/reduce
 core-js(-pure)/full/set/some
 core-js(-pure)/full/map/delete-all
 core-js(-pure)/full/map/every
 core-js(-pure)/full/map/filter
 core-js(-pure)/full/map/find
 core-js(-pure)/full/map/find-key
 core-js(-pure)/full/map/from
 core-js(-pure)/full/map/includes
 core-js(-pure)/full/map/key-by
 core-js(-pure)/full/map/key-of
 core-js(-pure)/full/map/map-keys
 core-js(-pure)/full/map/map-values
 core-js(-pure)/full/map/merge
 core-js(-pure)/full/map/of
 core-js(-pure)/full/map/reduce
 core-js(-pure)/full/map/some
 core-js(-pure)/full/map/update
 core-js(-pure)/full/weak-set/add-all
 core-js(-pure)/full/weak-set/delete-all
 core-js(-pure)/full/weak-set/of
 core-js(-pure)/full/weak-set/from
 core-js(-pure)/full/weak-map/delete-all
 core-js(-pure)/full/weak-map/of
 core-js(-pure)/full/weak-map/from
 ```
 `. of` / `. from` [*примеры*](https://tinyurl.com/27fktwtw):
 ```javascript
 Set.of(1, 2, 3, 2, 1); // => Set {1, 2, 3}
 Map.from([[1, 2], [3, 4]], ([key, value]) => [key ** 2, value ** 2]); // => Map { 1: 4, 9: 16 }
 ```
 ##### [`compositeKey` и `compositeSymbol`](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey)[⬆](#index)
 Модули [`esnext.composite-key`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.composite-key.js) и [`esnext.composite-symbol`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.composite-symbol.js)
 ```ts
function compositeKey(. . . args: Array<mixed>): object;
function compositeSymbol(. . . args: Array<mixed>): symbol;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/keys-composition
core-js(-pure)/full/composite-key
core-js(-pure)/full/composite-symbol
```
[*Примеры*](https://tinyurl.com/2c8pczur):
```js
// возвращает символ
const symbol = compositeSymbol({});
console.log(typeof symbol); // => 'symbol'
```// работает аналогично, но возвращает обычный замороженный объект без прототипа
const key = compositeKey({});
console.log(typeof key); // => 'object'
console.log({}.toString.call(key)); // => '[object Object]'
console.log(Object.getPrototypeOf(key)); // => null
console.log(Object.isFrozen(key)); // => true

const a = ['a'];
const b = ['b'];
const c = ['c'];/* eslint-disable no-self-compare -- пример */
console.log(compositeSymbol(a) === compositeSymbol(a)); // => true
console.log(compositeSymbol(a) !== compositeSymbol(['a'])); // => true
console.log(compositeSymbol(a, 1) === compositeSymbol(a, 1)); // => true
console.log(compositeSymbol(a, b) !== compositeSymbol(b, a)); // => true
console.log(compositeSymbol(a, b, c) === compositeSymbol(a, b, c)); // => true
console.log(compositeSymbol(1, a) === compositeSymbol(1, a)); // => true
console.log(compositeSymbol(1, a, 2, b) === compositeSymbol(1, a, 2, b)); // => true
console.log(compositeSymbol(a, a) === compositeSymbol(a, a)); // => true
```
##### [Фильтрация массива](https://github.com/tc39/proposal-array-filtering)[⬆](#index)
Модули [`esnext.array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.filter-reject.js) и [`esnext.typed-array.filter-reject`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.typed-array.filter-reject.js).
```ts
class Array {
  filterReject(callbackfn: (value: any, index: number, target: any) => boolean, thisArg?: any): Array<mixed>;
}
```
```markdown
class %TypedArray% {
  filterReject(callbackfn: (value: number, index: number, target: %TypedArray%) => boolean, thisArg?: any): %TypedArray%;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-filtering-stage-1
core-js(-pure)/full/array(/virtual)/filter-reject
core-js/full/typed-array/filter-reject
```
[*Примеры*](https://is.gd/jJcoWw):
```js
[1, 2, 3, 4, 5].filterReject(it => it % 2); // => [2, 4]
```
##### [Уникальные элементы в массиве](https://github.com/tc39/proposal-array-unique)[⬆](#index)
Модули [`esnext.array.unique-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.array.unique-by.js) и [`esnext.typed-array.unique-by`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.typed-array.unique-by.js)
```ts
class Array {
  uniqueBy(resolver?: (item: any) => any): Array<mixed>;
}
```class %TypedArray% {
  uniqueBy(resolver?: (item: any) => any): %TypedArray%;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/array-unique
core-js(-pure)/full/array(/virtual)/unique-by
core-js/full/typed-array/unique-by
```
[*Примеры*](https://is.gd/lilNPu):
```js
[1, 2, 3, 2, 1].uniqueBy(); // [1, 2, 3]

[
  { id: 1, uid: 10000 },
  { id: 2, uid: 10000 },
  { id: 3, uid: 10001 },
].uniqueBy(it => it.uid);    // => [{ id: 1, uid: 10000 }, { id: 3, uid: 10001 }]
```

##### [`DataView` get / set `Uint8Clamped` методы](https://github.com/tc39/proposal-dataview-get-set-uint8clamped)[⬆](#index)
Модули [`esnext.data-view.get-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.get-uint8-clamped.js) и [`esnext.data-view.set-uint8-clamped`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.data-view.set-uint8-clamped.js)
```ts
class DataView {
  getUint8Clamped(offset: any): uint8;
  setUint8Clamped(offset: any, value: any): void;
}
```
[*CommonJS entry points:*](#commonjs-api)
```
core-js/proposals/data-view-get-set-uint8-clamped
core-js/full/dataview/get-uint8-clamped
core-js/full/dataview/set-uint8-clamped
```
[Примеры](https://tinyurl.com/2h4zv8sw):
```js
const view = new DataView(new ArrayBuffer(1));
view.setUint8Clamped(0, 100500);
console.log(view.getUint8Clamped(0)); // => 255
```

##### [`Math.clamp`](https://github.com/CanadaHonk/proposal-math-clamp)[⬆](#index)
Модуль [`esnext.math.clamp`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.math.clamp.js)
```ts
class Math {
  clamp(value: number, min: number, max: number): number;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/math-clamp
core-js(-pure)/full/math/clamp
```
[*Пример*](https://tinyurl.com/2ayyqr8j):
```js
Math.clamp(5, 0, 10); // => 5
Math.clamp(-5, 0, 10); // => 0
Math.clamp(15, 0, 10); // => 10
```

##### [`Number.fromString`](https://github.com/tc39/proposal-number-fromstring)[⬆](#index)
Модуль [`esnext.number.from-string`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.number.from-string.js)
```ts
class Number {
  fromString(string: string, radix: number): number;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/number-from-string
core-js(-pure)/full/number/from-string
```##### [`String.cooked`](https://github.com/tc39/proposal-string-cooked)[⬆](#index)
Модуль [`esnext.string.cooked`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.cooked.js)
```ts
class String {
  static cooked(template: Array<string>, ...substitutions: Array<string>): string;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/string-cooked
core-js(-pure)/full/string/cooked
```
[*Пример*](https://is.gd/7QPnss):
```js
function safePath(strings, ...subs) {
  return String.cooked(strings, ...subs.map(sub => encodeURIComponent(sub)));
}

let id = 'spottie?';

safePath`/cats/${ id }`; // => /cats/spottie%3F
```
##### [`String.prototype.codePoints`](https://github.com/tc39/proposal-string-prototype-codepoints)[⬆](#index)
Модуль [`esnext.string.code-points`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.string.code-points.js)
```ts
class String {
  codePoints(): Iterator<{ codePoint: number, position: number }>;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/string-code-points
core-js(-pure)/full/string/code-points
```
[*Пример*](https://tinyurl.com/2bt9bhwn):
```js
for (let { codePoint, position } of 'qwe'.codePoints()) {
  console.log(codePoint); // => 113, 119, 101
  console.log(position);  // => 0, 1, 2
}
```
##### [`Symbol.customMatcher` для соответствия шаблону](https://github.com/tc39/proposal-pattern-matching)[⬆](#index)
Модуль [`esnext.symbol.custom-matcher`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.symbol.custom-matcher.js).
```ts
class Symbol {
  static customMatcher: @@customMatcher;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/pattern-matching-v2
core-js(-pure)/full/symbol/custom-matcher
```#### Предложения на стадии 0[⬆](#index)
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stage/0
```
##### [`Function.prototype.demethodize`](https://github.com/js-choi/proposal-function-demethodize)[⬆](#index)
Модуль [`esnext.function.demethodize`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.demethodize.js)
```ts
class Function {
  demethodize(): Function;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/function-demethodize
core-js(-pure)/full/function/demethodize
core-js(-pure)/full/function/virtual/demethodize
```
[*Примеры*](https://tinyurl.com/2ltmohgl):
```js
const slice = Array.prototype.slice.demethodize();
```slice([1, 2, 3], 1); // => [2, 3]
```
##### [`Function.isCallable`, `Function.isConstructor`](https://github.com/caitp/TC39-Proposals/blob/trunk/tc39-reflect-isconstructor-iscallable.md)[⬆](#index)Модули [`esnext.function.is-callable`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.is-callable.js), [`esnext.function.is-constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.function.is-constructor.js)
```ts
class Function {
  static isCallable(value: any): boolean;
  static isConstructor(value: any): boolean;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js/proposals/function-is-callable-is-constructor
core-js(-pure)/full/function/is-callable
core-js(-pure)/full/function/is-constructor
```
[*Примеры*](https://is.gd/Kof1he):
```js
/* eslint-disable prefer-arrow-callback -- example */
Function.isCallable(null);                        // => false
Function.isCallable({});                          // => false
Function.isCallable(function () { /* пустое */ }); // => true
Function.isCallable(() => { /* пустое */ });       // => true
Function.isCallable(class { /* пустое */ });       // => false
```
Функция.isКонструктор(null);                        // => false
Функция.isКонструктор({});                          // => false
Функция.isКонструктор(функция () { /* пустое */ }); // => true
Функция.isКонструктор(() => { /* пустое */ });       // => false
Функция.isКонструктор(класс { /* пустое */ });       // => true
```#### Предварительные стадии 0 предложений[⬆](#index)
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stage/pre
```
##### [`Reflect` метаданные](https://github.com/rbuckton/reflect-metadata)[⬆](#index)
Модули [`esnext.reflect.define-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.define-metadata.js), [`esnext.reflect.delete-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.delete-metadata.js), [`esnext.reflect.get-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata.js), [`esnext.reflect.get-metadata-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata-keys.js), [`esnext.reflect.get-own-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-own-metadata.js),com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.  reflect.  get-own-metadata. js), [`esnext.  reflect.  get-own-metadata-keys`](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.  reflect.  get-own-metadata-keys. js), [`esnext.  reflect.  has-metadata`](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.  reflect.  has-metadata. js), [`esnext.  reflect.  has-own-metadata`](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.  reflect.  has-own-metadata. js) и [`esnext.  reflect.  metadata`](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.  reflect.  metadata. js).
  ```ts
  namespace Reflect {
    defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey?  : PropertyKey): void;
    getMetadata(metadataKey: any, target: Object, propertyKey?  : PropertyKey): any;
    getOwnMetadata(metadataKey: any, target: Object, propertyKey?  : PropertyKey): any;
    hasMetadata(metadataKey: any, target: Object, propertyKey?  : PropertyKey): boolean;
    hasOwnMetadata(metadataKey: any, target: Object, propertyKey?  : PropertyKey): boolean;
    deleteMetadata(metadataKey: any, target: Object, propertyKey?  : PropertyKey): boolean;
    getMetadataKeys(target: Object, propertyKey?  : PropertyKey): Array<mixed>;
    getOwnMetadataKeys(target: Object, propertyKey?  : PropertyKey): Array<mixed>;
    metadata(metadataKey: any, metadataValue: any): decorator(target: Object, targetKey?  : PropertyKey) => void;
  }
  ```
  [*CommonJS точки входа:*](#commonjs-api)
  ```
  core-js/proposals/reflect-metadata
  ```
  core-js(-pure)/full/reflect/определить-метаданные
  core-js(-pure)/full/reflect/удалить-метаданные
  core-js(-pure)/full/reflect/получить-метаданные
  core-js(-pure)/full/reflect/получить-ключи-метаданных
  core-js(-pure)/full/reflect/получить-собственные-метаданные
  core-js(-pure)/full/reflect/получить-ключи-собственных-метаданных
  core-js(-pure)/full/reflect/имеет-метаданные
  core-js(-pure)/full/reflect/имеет-собственные-метаданные
  core-js(-pure)/full/reflect/метаданные
  ```
  [*Примеры*](https://tinyurl. com/27t6a5ya):
  ```js
  let object = {};
  Reflect.  defineMetadata('foo', 'bar', object);
  ``` Reflect. ownKeys(object);               // => []
 Reflect. getOwnMetadataKeys(object);    // => ['foo']
 Reflect. getOwnMetadata('foo', object); // => 'bar'
 ```### Веб-стандарты[⬆](#index)
 #### `self`[⬆](#index)
 [Спецификация](https://html.spec.whatwg.org/multipage/window-object.html#dom-self), модуль [`web.self`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.self.js)
 ```ts
 getter self: GlobalThisValue;
 ```
 [*CommonJS точки входа:*](#commonjs-api)
 ```
 core-js(-pure)/stable|actual|full/self
 ```
 [*Примеры*](https://tinyurl.com/27nghouh):
 ```js
 // eslint-disable-next-line no-restricted-globals -- example
 self.Array === Array; // => true
 ```#### `structuredClone`[⬆](#index)
[Спецификация](https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone), модуль [`web.structured-clone`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.structured-clone.js)
```ts
function structuredClone(value: Serializable, { transfer?: Sequence<Transferable> }): any;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/structured-clone
```
[*Примеры*](https://is.gd/RhK7TW):
```js
const structured = [{ a: 42 }];
const sclone = structuredClone(structured);
console.log(sclone);                      // => [{ a: 42 }]
console.log(structured !== sclone);       // => true
console.log(structured[0] !== sclone[0]); // => true
``````javascript
const circular = {};
circular.circular = circular;
const cclone = structuredClone(circular);
console.log(cclone.circular === cclone);  // => true
```
```javascript
structuredClone(42);                                            // => 42
structuredClone({ x: 42 });                                     // => { x: 42 }
structuredClone([1, 2, 3]);                                     // => [1, 2, 3]
structuredClone(new Set([1, 2, 3]));                            // => Set { 1, 2, 3 }
structuredClone(new Map([['a', 1], ['b', 2]]));                 // => Map { 'a' => 1, 'b' => 2 }
structuredClone(new Int8Array([1, 2, 3]));                      // => new Int8Array([1, 2, 3])
structuredClone(new AggregateError([1, 2, 3], 'message'));      // => new AggregateError([1, 2, 3], 'message')
structuredClone(new TypeError('message', { cause: 42 }));       // => new TypeError('message', { cause: 42 })
structuredClone(new DOMException('message', 'DataCloneError')); // => new DOMException('message', 'DataCloneError')
structuredClone(document.getElementById('myfileinput'));        // => new FileList
structuredClone(new DOMPoint(1, 2, 3, 4));                      // => new DOMPoint(1, 2, 3, 4)
structuredClone(new Blob(['test']));                            // => new Blob(['test'])
structuredClone(new ImageData(8, 8));                           // => new ImageData(8, 8)
// и т. д. ```markdown
```javascript
structuredClone(new WeakMap()); // => DataCloneError на ненаблюдаемых типах
```
> [!WARNING]
> - Многие платформенные типы не могут быть переданы в большинстве движков, так как у нас нет способа полифилить это поведение. Однако опция `.transfer` работает для некоторых платформенных типов. Я рекомендую избегать этой опции.
> - Некоторые конкретные платформенные типы не могут быть клонированы в старых движках. В основном это очень специфические типы или очень старые движки, но вот некоторые исключения. Например, у нас нет синхронного способа клонировать `ImageBitmap` в Safari 14.
>0- или Firefox 83-, поэтому рекомендуется обратиться к [источнику полифила](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.structured-clone.js), если вы хотите клонировать что-то конкретное.#### Утилиты для работы с Base64[⬆](#index)
[Спецификация](https://html.spec.whatwg.org/multipage/webappapis.html#atob), [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Base64). Модули [`web.atob`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.atob.js), [`web.btoa`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.btoa.js).
```ts
function atob(data: string): string;
function btoa(data: string): string;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/atob
core-js(-pure)/stable|actual|full/btoa
```
[*Примеры*](https://is.gd/4Nxmzn):
```js
btoa('hi, core-js');      // => 'aGksIGNvcmUtanM='
atob('aGksIGNvcmUtanM='); // => 'hi, core-js'
```
#### `setTimeout` и `setInterval`[⬆](#index)
Модуль [`web.timers`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.timers.js). Исправление дополнительных аргументов для IE9-.
```ts
function setTimeout(callback: any, time: any, ... args: Array<mixed>): number;
function setInterval(callback: any, time: any, ... args: Array<mixed>): number;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/set-timeout
core-js(-pure)/stable|actual|full/set-interval
```
```js
// До:
setTimeout(log.bind(null, 42), تلفزيون 1000);
// После:
setTimeout(log, 1000, 42);
```
#### `setImmediate`[⬆](#index)
Модуль [`web.immediate`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.immediate.js). Полифилл для [`setImmediate`](https://w3c.github.io/setImmediate/).
```ts
function setImmediate(callback: any, ... args: Array<mixed>): number;
function clearImmediate(id: number): void;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/set-immediate
core-js(-pure)/stable|actual|full/clear-immediate
```
[*Примеры*](https://tinyurl.com/25u8y8ks):
```js
setImmediate((arg1, arg2) => {
  console.log(arg1, arg2); // => Сообщение будет отображено с минимальной задержкой
}, 'Сообщение будет отображено', 'с минимальной задержкой');
```
#### `clearImmediate` и `setImmediate`[⬆](#index)
[Спецификация](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setimmediate)spec. whatwg. org/multipage/timers-and-user-prompts. html#dom-clearimmediate), модуль [`web. set-immediate`](https://github. com/zloirock/core-js/blob/master/packages/core-js/modules/web. set-immediate. js)
 ```ts
 function setImmediate(handler: Function): number;
 function clearImmediate(handler: number): void;
 ```
 [*CommonJS точки входа:*](#commonjs-api)
 ```
 core-js(-pure)/stable|actual|full/set-immediate
 ```
 [*Примеры*](https://tinyurl. com/2dk9f3zm):
 ```js
 clearImmediate(setImmediate(() => {
   console. log('Сообщение не будет отображено');
 }));
 ```#### `queueMicrotask`[⬆](#index)
[Спецификация](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask), модуль [`web.queue-microtask`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.queue-microtask.js)
```ts
function queueMicrotask(fn: Function): void;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/queue-microtask
```
[*Примеры*](https://tinyurl.com/2dk9f3zm):
```js
queueMicrotask(() => console.log('вызван как микротаск'));
```#### `URL` и `URLSearchParams`[⬆](#index)
 Реализация стандартов [URL](https://url.spec.whatwg.org/). Модули [`web.url`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.js), [`web.url.can-parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.can-parse.js), [`web.url.parse`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.parse.js), [`web.url.to-json`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.to-json.js), [`web.url-search-params`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.js), [`web.url-search-params.delete`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.delete.js), [`web.url-search-params.has`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.has.js), [`web.url-search-params.size`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url-search-params.size.js).
 ```ts
 class URL {
   constructor(url: string, base? : string);
   href: string;
   readonly origin: string;
   protocol: string;
   username: string;
   password: string;
   host: string;
   hostname: string;
   port: string;
   pathname: string;
   search: string;
   readonly searchParams: URLSearchParams;
   hash: string;
   toJSON(): string;
   toString(): string;
   static canParse(url: string, base? : string): boolean;
   static parse(url: string, base? : string): URL | null;
 }
 ```

## Класс URLSearchParams
```javascript
class URLSearchParams {
   constructor(params? : string | Iterable<[key, value]> | Object);
   append(name: string, value: string): void;
   delete(name: string, value? : string): void;
   get(name: string): string | void;
   getAll(name: string): Array<string>;
   has(name: string, value? : string): boolean;
   set(name: string, value: string): void;
   sort(): void;
   toString(): string;
   forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void;
   entries(): Iterator<[key, value]>;
   keys(): Iterator<key>;
   values(): Iterator<value>;
   @@iterator(): Iterator<[key, value]>;
   readonly attribute size: number;
 }
```

### [Основные точки входа CommonJS](#commonjs-api)
```
core-js/proposals/url
```core-js(-pure)/stable|actual|full/url
 core-js(-pure)/stable|actual|full/url/can-parse
 core-js/stable|actual|full/url/to-json
 core-js(-pure)/stable|actual|full/url-search-params
 ```
 ### Примеры
 ```javascript
 URL.canParse('https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'); // => true
 URL.canParse('https'); // => false
 ``````markdown
console.log(url.search); // => '?a=1&b=2&a=3&c=4'
console.log(url.href);   // => 'https://login:password@example.com:8080/?a=1&b=2&a=3&c=4#fragment'

const params = new URLSearchParams('?a=1&b=2&a=3');

params.append('c', 4);
params.append('a', 2);
params.delete('a', 1);
params.sort();

console.log(params.size); // => 4

for (let [key, value] of params) {
  console.log(key);   // => 'a', 'a', 'b', 'c'
  console.log(value); // => '3', '2', '2', '4'
}

console.log(params.has('a')); // => true
console.log(params.has('a', 3)); // => true
console.log(params.has('a', 4)); // => false

console.log(params.toString()); // => 'a=3&a=2&b=2&c=4'
```> [!WARNING]
> - IE8 не поддерживает сеттеры, поэтому они не работают для экземпляров `URL`. Однако конструктор `URL` может использоваться для базового парсинга URL.
> - Устаревшие кодировки в строке поиска не поддерживаются. Также реализация `core-js` имеет некоторые другие проблемы, связанные с кодировками.
> - Реализации `URL` из всех популярных браузеров имеют значительно больше проблем, чем `core-js`, однако замена всех из них не выглядит хорошей идеей. Можно настроить агрессивность полифила [в соответствии с вашими требованиями](#настраиваемый-уровень-агрессивности).
>
> ##### `DOMException`:[⬆](#index)
>
> [Описание в спецификации.](https://webidl.spec.whatwg.org/#idl-DOMException) Модули [`web.dom-exception.constructor`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.constructor.js), [`web.dom-exception.stack`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.stack.js), [`web.dom-exception.to-string-tag`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-exception.to-string-tag.js).
>
```ts
class DOMException {
  constructor(message: string, name?: string);
  readonly attribute name: string;
  readonly attribute message: string;
  readonly attribute code: string;
  attribute stack: string; // в тех движках, которые должны его поддерживать
  @@toStringTag: 'DOMException';
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/dom-exception
core-js(-pure)/stable|actual|full/dom-exception/constructor
core-js/stable|actual|full/dom-exception/to-string-tag
```
[*Примеры*](https://is.gd/pI6oTN):
```js
const exception = new DOMException('error', 'DataCloneError');
console.log(exception.name);                            // => 'DataCloneError'
console.log(exception.message);                         // => 'error'
console.log(exception.```code
);                            // => 25
console.log(typeof exception.stack);                    // => 'string'
console.log(exception instanceof DOMException);         // => true
console.log(exception instanceof Error);                // => true
console.log(exception.toString());                      // => 'DataCloneError: error'
console.log(Object.prototype.toString.call(exception));   // => '[object DOMException]'
```

#### Итерируемые коллекции DOM[](#index)
Некоторые коллекции DOM должны иметь [итерируемый интерфейс](https://heycam.github.io/webidl/#idl-iterable) или должны [наследоваться от `Array`](https://heycam.github.io/webidl/#LegacyArrayClass). Это означает, что они должны иметь методы для итерации, такие как `forEach`, `keys`, `values`, `entries` и `@@iterator`. Поэтому добавьте их. Модули [`web.dom-collections.iterator`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-collections.iterator.js) и [`web.dom-collections.for-each`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.dom-collections.for-each.js).
```ts
class [
  CSSRuleList,
  CSSStyleDeclaration,
  CSSValueList,
  ClientRectList,
  DOMRectList,
  DOMStringList,
  DataTransferItemList,
  FileList,
  HTMLAllCollection,
  HTMLCollection,
  HTMLFormElement,
  HTMLSelectElement,
  MediaList,
  MimeTypeArray,
  NamedNodeMap,
  PaintRequestList,
  Plugin,
  PluginArray,
  SVGLengthList,
  SVGNumberList,
  SVGPathSegList,
  SVGPointList,
  SVGStringList,
  SVGTransformList,
  SourceBufferList,
  StyleSheetList,
  TextTrackCueList,
  TextTrackList,
  TouchList,
] {
  @@iterator(): Iterator<value>;
}
``````markdown
### Помощники для итерации[⬆](#index)
Помощники для проверки итерируемости / получения итератора в "чистой" версии или, например, для объекта `arguments`:
```ts
function isIterable(value: any): boolean;
function getIterator(value: any): Object;
function getIteratorMethod(value: any): Function | void;
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js-pure/es|stable|actual|full/is-iterable
core-js-pure/es|stable|actual|full/get-iterator
core-js-pure/es|stable|actual|full/get-iterator-method
```
*Примеры*:
```js
import isIterable from 'core-js-pure/actual/is-iterable';
import getIterator from 'core-js-pure/actual/get-iterator';
import getIteratorMethod from 'core-js-pure/actual/get-iterator-method';
```

### Помощники для работы с коллекциями DOM[⬆](#index)
Помощники для работы с коллекциями DOM, такие как `DOMTokenList` и `NodeList`:
```typescript
class [DOMTokenList, NodeList] {
  forEach(callbackfn: (value: any, index: number, target: any) => void, thisArg: any): void;
  entries(): Iterator<[key, value]>;
  keys(): Iterator<key>;
  values(): Iterator<value>;
  @@iterator(): Iterator<value>;
}
```
[*CommonJS точки входа:*](#commonjs-api)
```
core-js(-pure)/stable|actual|full/dom-collections/iterator
core-js/stable|actual|full/dom-collections/for-each
```

[*Примеры*](https://tinyurl.com/25rcspv4):
```js
for (let { id } of document.querySelectorAll('*')) {
  if (id) console.log(id);
}

for (let [index, { id }] of document.querySelectorAll('*').entries()) {
  if (id) console.log(index, id);
}
```

Для использования функциональности, которая требует полифиллов, обратите внимание на следующие моменты:
```- ES `BigInt` не может быть полифиллом, так как это требует изменений в поведении операторов. Подробнее [здесь](https://github.com/zloirock/core-js/issues/381). Вы можете попробовать использовать [`JSBI`](https://github.com/GoogleChromeLabs/jsbi).
- ES `Proxy` не может быть полифиллом. Вы можете попробовать использовать [`proxy-polyfill`](https://github.com/GoogleChrome/proxy-polyfill), который предоставляет очень малое подмножество функций.
- ES `String#normalize` не является очень полезной функцией, но полифилл будет очень большим. Если вам это нужно, вы можете использовать [unorm](https://github.com/walling/unorm/).
- ECMA-402 `Intl` отсутствует из-за размера. Вы можете использовать [эти полифиллы](https://formatjs.io/docs/polyfills).
- `window.fetch` не является кросс-платформенной функцией, в некоторых средах это не имеет смысла. По этой причине я не думаю, что это должно быть в `core-js`. В свете большого количества запросов это *может быть* добавлено в будущем. Сейчас вы можете использовать, например, [этот полифилл](https://github.com/github/fetch).
```

Комментарии ( 0 )

Вы можете оставить комментарий после Вход в систему

Введение

Core-JS — это базовая зависимость babel-polyfill. Используя различные трюки, она реализовала большую часть нативного стандарта библиотеки ES2017 на ES3, при этом строго следуя спецификации. Развернуть Свернуть
JavaScript и 3 других языков
MIT
Отмена

Обновления

Пока нет обновлений

Участники

все

Недавние действия

Загрузить больше
Больше нет результатов для загрузки
1
https://api.gitlife.ru/oschina-mirror/mirrors-core-js.git
git@api.gitlife.ru:oschina-mirror/mirrors-core-js.git
oschina-mirror
mirrors-core-js
mirrors-core-js
master