# nice-loops

> Array iterators that yield to the event-loop periodically

Latest version **1.0.4** (published 2023-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install nice-loops
pnpm add nice-loops
yarn add nice-loops
bun add nice-loops
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2023-11-09 |
| First published | 2023-09-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 75.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pinko-fowle |

## Links

- npm: https://www.npmjs.com/package/nice-loops
- npm.io page: https://npm.io/package/nice-loops

## Recent versions

- 1.0.4 (latest) — 2023-11-09
- 1.0.3 — 2023-11-09
- 1.0.2 — 2023-11-09
- 1.0.1 — 2023-11-09
- 1.0.0 — 2023-09-11

## README

# 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.

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

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

---
_Source: https://npm.io/package/nice-loops · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
