/** * Represents Gherkin template: string with <> placeholders. * Example: 'Given is years old' */ export class GherkinTemplate { constructor(private template: string) {} fill(params: Record) { return this.template.replace(/<(.+?)>/g, (match, key) => { return params[key] !== undefined ? String(params[key]) : match; }); } extractParams() { return [...this.template.matchAll(/<(.+?)>/g)].map((m) => m[1]); } }