From deadcef62b5b3b71f3cb7ac0af484cdff1c3d382 Mon Sep 17 00:00:00 2001 From: invakid404 Date: Wed, 23 Jun 2021 10:08:58 +0300 Subject: [PATCH] feat: allow flags to be specified per transformer --- src/configuration.ts | 1 + src/transform.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/configuration.ts b/src/configuration.ts index e84531c..9b4f567 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -23,6 +23,7 @@ export interface Category { export interface Transformer { pattern: string target: string + flags?: string } export interface Extractor extends Transformer { diff --git a/src/transform.ts b/src/transform.ts index f50014e..a39ae22 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -247,7 +247,10 @@ function validateTransfomers( } return { - pattern: new RegExp(transformer.pattern.replace('\\\\', '\\'), 'gu'), + pattern: new RegExp( + transformer.pattern.replace('\\\\', '\\'), + transformer.flags ?? 'gu' + ), target: transformer.target, onProperty }