0.0.4 • Published 1 year ago

mapby v0.0.4

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
1 year ago

mapBy

mapBy is a typescript promise & concurrency utility for NodeJS.

Install

npm i mapby

Usage

import { mapBy } from 'mapby';

const input = [1, 2, 3];

const result = await mapBy(
  input,
  {
    /* Limit predicate function to be called max N times concurrently */
    concurrency: 5,
    /* Throw if error is reached, similar to Promise.all */
    abortOnError: true,
    /* Retry up to N times */
    retries: 3,
  },
  async (item, index) => {
    return item * index;
  },
  (err, item, index) => {
    console.error('Error occurred: ', { err, item, index });
  },
);
0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago