@apideck/portman
Version:
Port OpenAPI Spec to Postman Collection, with contract & variation tests included
18 lines • 808 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.writeRawReplacements = void 0;
var writeRawReplacements = function (collectionAsString, globalReplacements) {
globalReplacements.map(function (_a) {
var searchFor = _a.searchFor, replaceWith = _a.replaceWith;
var pattern = searchFor.replace(/"/g, '\\"');
var replacement = replaceWith.replace(/"/g, '\\"');
collectionAsString = collectionAsString.replace(new RegExp(escapeRegExp(pattern), 'g'), replacement);
return collectionAsString;
});
return collectionAsString;
};
exports.writeRawReplacements = writeRawReplacements;
var escapeRegExp = function (string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
};
//# sourceMappingURL=writeRawReplacements.js.map