Files
shields/lib/nodeify-sync.js
2017-10-14 15:41:56 -04:00

18 lines
303 B
JavaScript

'use strict';
// Execute a synchronous block and invoke a standard error-first callback with
// the result.
function nodeifySync(resultFn, callback) {
let result, error;
try {
result = resultFn();
} catch (e) {
error = e;
}
callback(error, result);
}
module.exports = nodeifySync;