blob: 26fa6099c74baeb8ea9a277b6310a8876e15180d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import retry from './retry';
import rest from 'lodash/rest';
export default function (opts, task) {
if (!task) {
task = opts;
opts = null;
}
return rest(function (args) {
var callback = args.pop();
function taskFn(cb) {
task.apply(null, args.concat([cb]));
}
if (opts) retry(opts, taskFn, callback);
else retry(taskFn, callback);
});
}
|