node-mongo-querystring icon indicating copy to clipboard operation
node-mongo-querystring copied to clipboard

valRegex improperly referenced

Open derek-rmd opened this issue 6 years ago • 0 comments

https://github.com/Turistforeningen/node-mongo-querystring/blob/9e3554c2b1ea09a0845ae0526647ca5da21d33d4/index.js#L184

  • should be this.valRegex not this.valReqex
  • but then this will replace all valid characters with '', instead of invalid chars
  • and is also overwritten for ^ and $ a few lines below
    • this should be ret.value = `^${ret.value}`; instead
  • an option like escapeRegex: true might be more appropriate here
    • or escapeRegexChars: /[\\^$.*+?()[\]{}|]/g, where use s.replace(this.escapeRegexChars, '\\$&') to escape (source: lodash _.escapeRegex)

derek-rmd avatar Jul 09 '19 17:07 derek-rmd