1.0.4 • Published 6 months ago

nice-loops v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

nice-loops

A spin on common Array methods like forEach, map, reduce, that periodically yield to the event loop

Implemented

  • forEach
  • map
  • reduce
  • find
  • some
  • every

Ending Iteration

Unlike in regular JavaScript, all iterations can be terminated early. In the callback function, returning the EndIteration symbol will stop iteration. At the moment you'll need to read the source to see what gets returned.

import { map, symbol } from "nice-loops"

await map([1, 2, 3, 4, 5], (n => (n < 3) ? (n * 2) : symbol.EndIteration) //=> [2, 4]
1.0.2

6 months ago

1.0.1

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.0

8 months ago