PNPM (recommended)
pnpm install reducebatch
Yarn (also good)
yarn add reducebatch
NPM (if you must...)
npm install --save reducebatch
This package supports both ES Module and CommonJS (node
) syntaxes.
import { reduceBatch, reduceBatchSync } from "reducebatch";
import reduceBatchSync from "reducebatch/sync";
const { reduceBatch, reduceBatchSync } = require("reducebatch");
// fill an array with 5000 consecutive numeric values
const bigArray = Array.from(Array(5000), (_, i) => i);
reduceBatch(bigArray, (acc, cur) => acc + cur, 0 /* initialVal */, 100 /* batchSize */, 500 /* rateLimit */).then(
console.log
);
// ... 12497500
// batchSize: 100 (50 batches of 100)
// rateLimit: 500 (maximum per second)
One of the most overlooked aspects of the Open Source community is the impact of contributions. Projects (like reduceBatch
), and their maintainers (like me 👋 ), depend on contributions from other members like yourself.
Furthermore, they're the cornerstone of why our community continues to be such an amazing place to learn, inspire, and create.
Any contributions you make are greatly appreciated.
- Found a bug? Have a feature request? Please open an issue and let me know!
- Create a dedicated PR for each feature/change to the API.
- Please also read through the Code of Conduct beforehand.
- Please make sure you check your spelling and grammar.
- Fork the project
- Create your feature branch
git checkout -b feature/something-dope
- Commit your changes
git commit -m 'Some info about what you added...'
- Push to the Branch
git push -u origin feature/something-dope
- Open a Pull Request
# Using the GitHub CLI
gh pr create --title "[feature]: something dope!"