salsita / prism

React / Redux action composition made simple http://salsita.github.io/prism/
496 stars 24 forks source link

prism-redux/escapeRegexp.js is missing a character in the regex #79

Closed jcheroske closed 7 years ago

jcheroske commented 7 years ago

The replace() call is missing a '$' character:

Original file:

const ESCAPE_PATTERN = /[|\\{}()[\]^$+*?.]/g;

export default (value : string) => value
  .replace(ESCAPE_PATTERN, '\\&');

Should be

const ESCAPE_PATTERN = /[|\\{}()[\]^$+*?.]/g;

export default (value : string) => value
  .replace(ESCAPE_PATTERN, '\\$&'); // <-- need a $ here!

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions