text: "use strict";
  
  /**
   * Turns a promise into a callback function
   * @param {function} fn Function
   * @returns {function}
   */
  function callbackify(fn) {
      if(typeof fn !== "function") throw new TypeError("Argument is not a function");
      return (...args) => {
          let cb = args[args.length - 1];
          if(typeof cb !== "function") throw new TypeError("Argument is not a function");
          return fn(...args.slice(0, -1)).then(v => cb(v));
      };
  };
  
  // Exports
  module.exports = callbackify;