code: function _then(callback, resolve, reject) {
    return function (result) {
      try {
        var res = callback(result);
        if (res && typeof res.then === 'function' && typeof res['catch'] === 'function') {
          // method returned a promise
          res.then(resolve, reject);
        }
        else {
          resolve(res);
        }
      }
      catch (error) {
        reject(error);
      }
    }
  }
docs: Execute given callback, then call resolve/reject based on the returned result
  @param {Function} callback
  @param {Function} resolve
  @param {Function} reject
  @returns {Function}
  @private