diff options
Diffstat (limited to 'test/test-translator.js')
-rw-r--r-- | test/test-translator.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test-translator.js b/test/test-translator.js index 892448a5..cee7fe16 100644 --- a/test/test-translator.js +++ b/test/test-translator.js @@ -107,6 +107,16 @@ function buildOptions(optionsPresets, optionsArray, dictionaryTitle) { } } + // Construct regex + if (Array.isArray(options.textReplacements)) { + options.textReplacements = options.textReplacements.map((value) => { + if (Array.isArray(value)) { + value = value.map(({pattern, flags, replacement}) => ({pattern: new RegExp(pattern, flags), replacement})); + } + return value; + }); + } + // Update structure const placeholder = '${title}'; if (options.mainDictionary === placeholder) { |