const path = require('path');

module.exports = function (source) {
  const name = path.basename(this.resourcePath, path.extname(this.resourcePath));
  const options = this.getOptions();

  if (options.target.test(name)) {
    return source.replace(options.pattern, options.replace);
  }
  return source;
};
