mockttp
Version:
Mock HTTP server for testing HTTP clients and stubbing webservices
19 lines • 1.16 kB
TypeScript
/**
* An array of match/replace pairs. These will be applied to the initial value
* like `input.replace(p1, p2)`, applied in the order provided. The first parameter
* can be either a string or RegExp to match, and the second must be a string to
* insert. The normal `str.replace` $ placeholders can be used in the second
* argument, so that e.g. $1 will insert the 1st matched group.
*/
export type MatchReplacePairs = Array<[string | RegExp, string]>;
export declare function applyMatchReplace(input: string, matchReplace: MatchReplacePairs): string;
export type SerializedRegex = {
regexSource: string;
flags: string;
};
export declare const serializeRegex: (regex: RegExp) => SerializedRegex;
export declare const deserializeRegex: (regex: SerializedRegex) => RegExp;
export type SerializedMatchReplacePairs = Array<[SerializedRegex | string, string]>;
export declare const serializeMatchReplaceConfiguration: (matchReplace: MatchReplacePairs) => SerializedMatchReplacePairs;
export declare const deserializeMatchReplaceConfiguration: (matchReplace: SerializedMatchReplacePairs) => MatchReplacePairs;
//# sourceMappingURL=match-replace.d.ts.map