0.0.4 • Published 5 years ago

throttled-concurrent-actions v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

throttled-concurrent-actions

Like Promise.all, but throttled

Requirements

  • Node.js ≥ 8.9.0

Function Signature

declare function throttledConcurrentActions<X> (count: number, list: Action<X>[]): Promise<X[]>
type Action<X> = (x?: X) => X | Promise<X>

Usage Example

import throttledConcurrentActions from 'throttled-concurrent-actions'

const result = await throttledConcurrentActions(
  3,
  [
    () => 'Sync Example',
    async () => 'Async Example',
    () => 'Another Sync Example',
    async past => ({past}),
    past => ({past})
  ]
)

Result:

[
  'Sync Example',
  'Async Example',
  'Another Sync Example',
  {past: 'Sync Example'},
  {past: 'Async Example'}
]

License

MIT © Hoàng Văn Khải

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago