Gathering detailed insights and metrics for iterate-iterator
Gathering detailed insights and metrics for iterate-iterator
Gathering detailed insights and metrics for iterate-iterator
Gathering detailed insights and metrics for iterate-iterator
Iterate any JS iterator. Works robustly in all environments, all versions.
npm install iterate-iterator
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
87.7
Quality
75.4
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
750,522,038
Last Day
139,363
Last Week
2,246,142
Last Month
9,672,708
Last Year
107,509,462
MIT License
2 Stars
44 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Feb 06, 2025
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
iterate-iterator@1.0.2
Size
6.11 kB
NPM Version
7.24.0
Node Version
16.10.0
Published on
Oct 01, 2021
Cumulative downloads
Total Downloads
Last Day
-16.2%
139,363
Compared to previous day
Last Week
-9.5%
2,246,142
Compared to previous week
Last Month
8%
9,672,708
Compared to previous month
Last Year
-30.7%
107,509,462
Compared to previous year
Iterate any iterable JS iterator. Works robustly in all environments, all versions.
In modern engines, [...value]
or Array.from(value)
or for (const item of value) { }
are sufficient to iterate an iterable value (an object with a Symbol.iterator
method), which includes all builtin iterators. However, older engines:
Symbol
, array spread, or for..of
support altogetherSymbol.iterator
but not implement it on everything it should, like arguments objectsMap
and Set
, but a non-standard name for the iterator-producing method (.iterator
or ['@@iterator']
, eg) and no syntax to support ites6-shim
or core-js
or similarThis library simplifies iterating an iterator object, so no loops are required.
If called with a single iterator, it will return an array of the yielded values. If also called with a callback function, it will instead call that callback once for each yielded value.
1var iterate = require('iterate-iterator'); 2var getIterator = require('es-get-iterator'); 3var assert = require('assert'); 4 5assert.deepEqual(iterate(getIterator('a ????')), ['a', ' ', '????']); 6assert.deepEqual(iterate(getIterator([1, 2])), [1, 2]); 7assert.deepEqual(iterate(getIterator(new Set([1, 2]))), [1, 2]); 8assert.deepEqual(iterate(getIterator(new Map([[1, 2], [3, 4]]))), [[1, 2], [3, 4]]); 9 10function assertWithCallback(iterable, expected) { 11 var values = []; 12 var callback = function (x) { values.push(x); }; 13 iterate(iterable, callback); 14 assert.deepEqual(values, expected); 15} 16assertWithCallback(getIterator('a ????'), ['a', ' ', '????']); 17assertWithCallback(getIterator([1, 2]), [1, 2]); 18assertWithCallback(getIterator(new Set([1, 2])), [1, 2]); 19assertWithCallback(getIterator(new Map([[1, 2], [3, 4]])), [[1, 2], [3, 4]]);
Simply clone the repo, npm install
, and run npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More