mirror-rhinstaller-node-cache/es-iterator-helpers
2026-06-15 08:05:17 +00:00
..
aos 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.concat 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.from 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.constructor 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.drop 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.every 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.filter 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.find 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.flatMap 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.forEach 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.includes 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.map 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.reduce 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.some 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.take 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.prototype.toArray 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.zip 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
Iterator.zipKeyed 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
IteratorHelperPrototype 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
test 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
WrapForValidIteratorPrototype 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
.nycrc 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
auto.js 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
CHANGELOG.md 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
eslint.config.mjs 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
index.json 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
LICENSE 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
package.json 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
README.md 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +00:00
shim.js 59aa210f76a766832e4013c3105697047c38ba1ef2a752c58a10e46a4664c272 package.json 2026-06-15 08:05:17 +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.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).