UNPKG

qrate

Version:

A Node.js queue library with controllable concurrency and rate limiting

9 lines (6 loc) 254 B
import asyncify from './asyncify.js' import isAsync from './isAsync.js' export default function wrapAsync (asyncFn) { if (typeof asyncFn !== 'function') throw new Error('expected a function') return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn }