-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
import eachOf from './eachof'; | ||
var applyEach = require('async.util.applyeach'); | ||
|
||
export default applyEach(eachOf); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
import eachOfSeries from './eachOfSeries'; | ||
import applyEach from './applyEach'; | ||
|
||
export default applyEach(eachOfSeries); |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
import isObject from 'lodash/lang/isObject'; | ||
import restParam from 'lodash/function/restParam'; | ||
|
||
export default function asyncify(func) { | ||
return restParam(function (args) { | ||
var callback = args.pop(); | ||
var result; | ||
try { | ||
result = func.apply(this, args); | ||
} catch (e) { | ||
return callback(e); | ||
} | ||
// if result is Promise object | ||
if (isObject(result) && typeof result.then === 'function') { | ||
result.then(function(value) { | ||
callback(null, value); | ||
})['catch'](function(err) { | ||
callback(err.message ? err : new Error(err)); | ||
}); | ||
} else { | ||
callback(null, result); | ||
} | ||
}); | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.