/
lostSun
/
project-client-server-apps
Обзор
Документация
Войти
/
lostSun
/
project-client-server-apps
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/core-js/modules/es.iterator.for-each.js
32 строки
1 KB
1lostsun
initial commit
05 май 2025, 11:35
05 май 2025, 11:35
fe8f535
Код
Авторство
О чём код?
'use strict'; var $ = require('../internals/export'); var call = require('../internals/function-call'); var iterate = require('../internals/iterate'); var aCallable = require('../internals/a-callable'); var anObject = require('../internals/an-object'); var getIteratorDirect = require('../internals/get-iterator-direct'); var iteratorClose = require('../internals/iterator-close'); var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error'); var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('forEach', TypeError); // `Iterator.prototype.forEach` method // https://tc39.es/ecma262/#sec-iterator.prototype.foreach $({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, { forEach: function forEach(fn) { anObject(this); try { aCallable(fn); } catch (error) { iteratorClose(this, 'throw', error); } if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn); var record = getIteratorDirect(this); var counter = 0; iterate(record, function (value) { fn(value, counter++); }, { IS_RECORD: true }); } });