Repeat 🔁

@common-utilities/repeat 🧰

Typed with TypeScript npm version

Repeat is a common function composed of function arguments that recursively invoke a callback function based on iterations returning a final value.

The repeat function can be used to replace while loops.

Install

yarn add @common-utilities/repeat -D

Usage

const add1 = (val) => val + 1
repeat(100)(add1)(0) // 100

Common Utilities 🧰

No cruft. No bloat. No dependencies.

Simple, typed, functional, documented, and tested javascript utility functions.

View other common utilities on Github.

Last updated

Was this helpful?