# jsbatch

> Asynchronous batch iteration of arrays using promises for callbacks

Latest version **1.0.0** (published 2015-10-21) · 0 weekly downloads

## Install

```sh
npm install jsbatch
pnpm add jsbatch
yarn add jsbatch
bun add jsbatch
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-10-21 |
| First published | 2015-10-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Price |
| Maintainers | pudge601 |
| Keywords | batch, promise, array, process, map, reduce |

## Links

- npm: https://www.npmjs.com/package/jsbatch
- Repository: https://github.com/Pudge601/jsbatch
- Issues: https://github.com/Pudge601/jsbatch/issues
- npm.io page: https://npm.io/package/jsbatch

## Dependencies (1)

- [promise](https://npm.io/package/promise.md) 7.x.x

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-10-21

## README

# jsbatch

## Batch Iterator for NodeJS and Browser

A module for providing asynchronous batch iteration of arrays, using promises for callbacks.

The purpose of this library is essentially to provide a simple implementation of the concept shown in [this blog post](https://www.nczonline.net/blog/2009/08/11/timed-array-processing-in-javascript/),
with the addition of some helper methods for map and reduce, and using promises for the callback when the work is complete.

This library should allow for heavy processing of javascript arrays without locking up the browser/thread, by performing
the work asynchronously and pausing between batches of work.

## Example

Map an array, doubling each value.
```javascript
var batch = require('jsbatch');

batch.map([1, 2, 3, 4, 5], function(x) { return 2 * x; })
    .then(function(mapped) {
        console.log(mapped); // [2, 4, 6, 8, 10]
    });
```

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