gpc-replacer
Version:
This GherKing Precompiler is responsible to replace keys in feature files with given values.
21 lines • 705 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// eslint-disable-next-line @typescript-eslint/no-var-requires
const debug = require("debug")("gpc:replacer");
class Replacer {
constructor(config) {
debug('Initialize(config: %o)', config);
if (typeof config !== 'object') {
throw new TypeError('Configuration is not an object: ' + config);
}
this.config = config;
}
onDocument(d) {
for (const key in this.config) {
const toReplace = new RegExp(`\\$\\{${key}\\}`, 'gi');
d.replace(toReplace, this.config[key]);
}
}
}
exports.default = Replacer;
//# sourceMappingURL=index.js.map