@yunfly/chunk-promise
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

chunk-promise Build Status Coverage Status

这个模块将Promise分成多个块,并依次执行它

This module breaks the Promise into chunks and executes it in turn

Install

  npm i @yunfly/chunk-promise

USE

  import { chunkPromise } from '../lib/index';

  var promises = [
      () => Promise.resolve('a'),
      () => Promise.resolve('b'),
      () => Promise.resolve('c'),
      () => Promise.resolve('d'),
      () => Promise.resolve('e'),
      () => Promise.resolve('f'),
      () => Promise.resolve('g'),
    ]

    chunkPromise(promises, 2)
      .then(results => {
        // ["a", "b", "c", "d", "e", "f", "g"]
        // do something
      });

Dependents (0)

Package Sidebar

Install

npm i @yunfly/chunk-promise

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

5.47 kB

Total Files

6

Last publish

Collaborators

  • yunfly