Responder.prototype.handleRewrite = function()

in src/responder.js [180:198]


Responder.prototype.handleRewrite = function(item) {
  const self = this;
  if (item.rewrite.destination) {
    return self.handleFile({ file: item.rewrite.destination });
  }

  for (const key in this.rewriters) {
    if (item.rewrite[key]) {
      return this.rewriters[key](item.rewrite, this).then((result) => {
        return self._handle(result);
      });
    }
  }
  return Promise.reject(
    new Error(
      "Unable to find a matching rewriter for " + JSON.stringify(item.rewrite)
    )
  );
};