1.0.4 • Published 2 years ago

nice-loops v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

1.0.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago