mirror-rhinstaller-node-cache/es-iterator-helpers
2026-09-28 07:03:59 +00:00
..
aos 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.concat 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.from 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.chunks 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.constructor 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.drop 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.every 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.filter 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.find 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.flatMap 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.forEach 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.includes 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.join 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.map 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.reduce 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.some 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.take 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.toArray 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.prototype.windows 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.zip 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
Iterator.zipKeyed 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
IteratorHelperPrototype 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
test 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
WrapForValidIteratorPrototype 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
.nycrc 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
auto.js 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
CHANGELOG.md 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
eslint.config.mjs 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
index.json 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
LICENSE 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
package.json 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
README.md 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00
shim.js 599101c2959ea504d8e9185b484074f77867d03949caa8f1d6b61909f57eba72 package.json 2026-09-28 07:03:59 +00:00

es-iterator-helpers Version Badge

github actions coverage License Downloads

npm badge

An ESnext spec-compliant sync iterator helpers shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API “multi” interface. It works in an ES3-supported environment and complies with the iterator helpers spec and the iterator sequencing spec.

Because the Iterator.prototype methods depend on a receiver (the this value), the main export in each subdirectory takes the iterator to operate on as the first argument.

The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.

Supported things

Environments where this is needed

  • node < v22, Chrome < v122, Safari <= v17.1, Firefox <= v125: not implemented
  • node v22, Chrome v122 - v130: has a bug where { next: null } is not properly rejected
  • node v22 - v24, Chrome v122 - v134: missing early-error IteratorClose when argument validation fails (e.g., non-callable mapper does not call the iterator's return method)
  • all environments lack Iterator.concat, Iterator.zip, Iterator.zipKeyed, Iterator.prototype.chunks, Iterator.prototype.windows, Iterator.prototype.join, Iterator.prototype.includes

Getting started

npm install --save es-iterator-helpers

Usage/Examples

Using explicit imports:

const map = require('es-iterator-helpers/Iterator.prototype.map');
const toArray = require('es-iterator-helpers/Iterator.prototype.toArray');
const assert = require('assert');

const iterator = [1, 2, 3].values();

const mapped = map(iterator, (x) => x + 10);
assert.deepEqual(
	mapped.next(),
    {
        done: false,
        value: 11,
    }
);
assert.deepEqual(
    toArray(mapped),
    [12, 13]
);

Shim using require:

require('es-iterator-helpers/auto'); // shim all of the methods

require('es-iterator-helpers/Iterator.prototype.map/auto'); // shim the “map” method

Shim using import syntax:

import 'es-iterator-helpers/auto'; // shim all of the methods

import 'es-iterator-helpers/Iterator.prototype.map/auto'; // shim the “map” method

Tests

Simply clone the repo, npm install, and run npm test

Additionally, the official test262 Iterator suite is included as a git submodule and can be run against the shim with npm run test262 (in CI this runs across a range of Node versions, from one with no native iterator helpers up to the current LTS). Initialize the submodule first with git submodule update --init --depth 1 (or clone with --recurse-submodules).