Gathering detailed insights and metrics for iterate-value
Gathering detailed insights and metrics for iterate-value
Gathering detailed insights and metrics for iterate-value
Gathering detailed insights and metrics for iterate-value
map-obj
Map object keys and values into a new object
filter-obj
Filter object keys and values into a new object
camelcase-keys
Convert object keys to camel case
for-in
Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js
Iterate any iterable JS value. Works robustly in all environments, all versions.
npm install iterate-value
Typescript
Module System
Node Version
NPM Version
98.2
Supply Chain
87.7
Quality
75
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
751,210,417
Last Day
139,319
Last Week
2,237,672
Last Month
9,633,337
Last Year
106,979,730
MIT License
3 Stars
48 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Jun 09, 2024
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
iterate-value@1.0.2
Size
5.74 kB
NPM Version
6.13.4
Node Version
13.6.0
Published on
Jan 18, 2020
Cumulative downloads
Total Downloads
Last Day
-16.3%
139,319
Compared to previous day
Last Week
-9.6%
2,237,672
Compared to previous week
Last Month
7.9%
9,633,337
Compared to previous month
Last Year
-30.5%
106,979,730
Compared to previous year
Iterate any iterable JS value. 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). 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 attempts to provide an abstraction over all that complexity!
If called with a single value, 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.
In node v13+, exports
is used by the es-get-iterator
dependency to provide a lean implementation that lacks all the complexity described above, in combination with the browser
field so that bundlers will pick up the proper implementation.
If you are targeting browsers that definitely all have Symbol support, then you can configure your bundler to replace require('has-symbols')()
with a literal true
, which should allow dead code elimination to reduce the size of the bundled code.
1var iterate = require('iterate-value'); 2var assert = require('assert'); 3 4assert.deepEqual(iterate('a ????'), ['a', ' ', '????']); 5assert.deepEqual(iterate([1, 2]), [1, 2]); 6assert.deepEqual(iterate(new Set([1, 2])), [1, 2]); 7assert.deepEqual(iterate(new Map([[1, 2], [3, 4]])), [[1, 2], [3, 4]]); 8 9function assertWithCallback(iterable, expected) { 10 var values = []; 11 var callback = function (x) { values.push(x); }; 12 iterate(iterable, callback); 13 assert.deepEqual(values, expected); 14} 15assertWithCallback('a ????', ['a', ' ', '????']); 16assertWithCallback([1, 2], [1, 2]); 17assertWithCallback(new Set([1, 2]), [1, 2]); 18assertWithCallback(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/24 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