Skip to content

Commit

Permalink
Merge pull request #746 from soledadse/main
Browse files Browse the repository at this point in the history
fix(io): flow.Class  some regular expressions don´t works
  • Loading branch information
leifermendez committed Aug 5, 2023
2 parents 45fff61 + b93a359 commit ec4c60d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/bot/io/flow.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class FlowClass {
overFlow = overFlow ?? this.flowSerialize

const mapSensitive = (str, mapOptions = { sensitive: false, regex: false }) => {
if (mapOptions.regex) return new RegExp(str)
const regexSensitive = mapOptions.sensitive ? 'g' : 'gi'

if (mapOptions.regex) return new Function(`return ${str}`)();
const regexSensitive = mapOptions.sensitive ? 'g' : 'i'

if (Array.isArray(str)) {
const patterns = mapOptions.sensitive ? str.map((item) => `\\b${item}\\b`) : str
return new RegExp(patterns.join('|'), regexSensitive)
Expand Down

0 comments on commit ec4c60d

Please sign in to comment.