code: function defer() {
    const def = promiseDefer();
  
    def.apply = function (err, result) {
      if (err) {
        def.reject(err);
      } else {
        def.resolve(result);
      }
    };
  
    return def;
  }
docs: Use ES6 promises
  @returns {{apply: function}}