js-libp2p-crypto/src/nodeify.js
2017-08-17 06:38:26 +02:00

12 lines
248 B
JavaScript

'use strict'
// Based on npmjs.com/nodeify but without additional `nextTick` calls
// to keep the overhead low
module.exports = function nodeify (promise, cb) {
return promise.then((res) => {
cb(null, res)
}, (err) => {
cb(err)
})
}