
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@finibit/iterate
Advanced tools
@finibit/iterateIterate over objects, strings and collections using a single function.
Requires Node.js version >=16.15.0.
Install using NPM:
npm i @finibit/iterate
Import iterate function using import statement:
import iterate from '@finibit/iterate'
The iterate function accepts a value to iterate over, and a function to call for each element of that value. The
value can be an any iterable value, e.g. array, string, or an object.
When iterating over iterables, the function receives three arguments. The first one is the current element. The second one is the index of the element. The third one is the iterable object itself:
// array
iterate([1, 2, 3], (value, index, array) => {})
// string
iterate('abc', (char, index, string) => {})
// set
iterate(new Set('a', 'b', 'c'), (value, index, set) => {})
// integer
iterate(10, (integer) => {})
When iterating over objects, the function also receives three arguments. The first one is the value of the current property. The second one is the key of that property. The third one is the object itself.
iterate({ a: 1, b: 2, c: 3 }, (value, key, object) => {})
Although, the built-in Map type is technically an iterable, it is treated like an object by the iterate function:
iterate(new Map([[1, 'a'], [2, 'b'], [3, 'c']], (value, key, map) => {}))
You can use more specific functions if you know your type.
For iterables use iterateIterable:
import { iterateIterable } from '@finibit/iterate'
iterateIterable([1, 2, 3], (value, index, array) => {})
For objects use iterateObject:
import { iterateObject } from '@finibit/iterate'
iterateObject({ a: 1, b: 2, c: 3 }, (value, key, object) => {})
For the built-in Map use iterateMap:
import { iterateMap } from '@finibit/iterate'
iterateMap(new Map([[1, 'a'], [2, 'b'], [3, 'c']], (value, key, map) => {}))
You can iterate over negative integer values too:
import { iterateInteger } from '@finibit/iterate'
iterateInteger(-10, (integer) => {})
FAQs
Iterate over objects, strings and collections
We found that @finibit/iterate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.