lib/devtools.js
function promisesWrapper(func) {
    return (options, callback) => {
        // options is an optional argument
        if (typeof options === 'function') {
            callback = options;
            options = undefined;
        }
        options = options || {};
        // just call the function otherwise wrap a promise around its execution
        if (typeof callback === 'function') {
            func(options, callback);
            return undefined;
        } else {
            return new Promise((fulfill, reject) => {
                func(options, (err, result) => {
                    if (err) {
                        reject(err);
                    } else {
                        fulfill(result);
                    }
                });
            });
        }
    };
}
function promisesWrapper(func) {
    return (options, callback) => {
        // options is an optional argument
        if (typeof options === 'function') {
            callback = options;
            options = undefined;
        }
        options = options || {};
        // just call the function otherwise wrap a promise around its execution
        if (typeof callback === 'function') {
            func(options, callback);
            return undefined;
        } else {
            return new Promise((fulfill, reject) => {
                func(options, (err, result) => {
                    if (err) {
                        reject(err);
                    } else {
                        fulfill(result);
                    }
                });
            });
        }
    };
}
function promisesWrapper ( func ) { return ( options , callback ) => { // options is an optional argument if ( typeof options === 'function' ) { callback = options ; options = undefined ; } options = options || { } ; // just call the function otherwise wrap a promise around its execution if ( typeof callback === 'function' ) { func ( options , callback ) ; return undefined ; } else { return new Promise ( ( fulfill , reject ) => { func ( options , ( err , result ) => { if ( err ) { reject ( err ) ; } else { fulfill ( result ) ; } } ) ; } ) ; } } ; }
wrapper that allows to return a promise if the callback is omitted, it works for DevTools methods
wrapper that allows to return a promise if the callback is omitted it works for DevTools methods