mirror-rhinstaller-node-cache/es-iterator-helpers
2026-10-07 13:11:50 +00:00
..
aos 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.concat 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.from 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.chunks 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.constructor 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.drop 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.every 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.filter 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.find 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.flatMap 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.forEach 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.includes 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.join 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.map 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.reduce 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.some 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.take 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.toArray 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.prototype.windows 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.zip 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
Iterator.zipKeyed 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
IteratorHelperPrototype 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
test 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
WrapForValidIteratorPrototype 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
.nycrc 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
auto.js 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
CHANGELOG.md 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
eslint.config.mjs 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
index.json 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
LICENSE 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
package.json 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
README.md 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +00:00
shim.js 8986ea02568055672e1beddb78d7e5aed90251028babf76ed1d8d56afb5edf35 package.json 2026-10-07 13:11:50 +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).