code: function callbackify(func) {
    return function(...args) {
      if (args.length === 0
          || typeof args[args.length - 1] !== 'function') {
        throw new Error(`${func.name || 'Function'} requires a callback.`);
      }
  
      const callback = args.pop();
  
      func.call(this, ...args).then((value) => {
        setImmediate(() => callback(null, value));
      }, (err) => {
        setImmediate(() => callback(err));
      });
    };
  }
docs: Wrap a promise-returning function
  into a function that accepts a
  node.js style callback.
  @param {AsyncFunction} func
  @returns {Function}