mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
- Base bindings class to extend - Move docs to base binding - Make all bindings classes - Ditch push bindings because it doesn't make anything cleaner
20 lines
374 B
JavaScript
20 lines
374 B
JavaScript
'use strict';
|
|
|
|
function promisify(func) {
|
|
return function() {
|
|
return new Promise((resolve, reject) => {
|
|
const args = Array.prototype.slice.apply(arguments);
|
|
args.push((err, data) => {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
resolve(data);
|
|
});
|
|
func.apply(null, args);
|
|
});
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
promisify
|
|
};
|