@vyriy/recursive
v0.6.0
Published
Recursive iteration utility for Vyriy projects
Readme
@vyriy/recursive
Recursive iteration utility for Vyriy projects.
Purpose
This package provides a small helper for recursively iterating through a list and applying an async handler to each item.
Install
With npm:
npm install @vyriy/recursiveWith Yarn:
yarn add @vyriy/recursiveUsage
import { recursive } from '@vyriy/recursive';
await recursive(
async (item) => {
console.log(item);
},
['one', 'two', 'three'],
);Exports
The package exposes both the root entry and the direct utility module:
import { recursive } from '@vyriy/recursive';API
recursive(handler, list)calls the asynchandlerfor each truthy item inlist.- iteration stops when the current
list[index]value is falsy.
