Ensure escapeRegExp returns an empty string when passing falsy values (#4432)

* Enable escapeRegExp tests

* Ensure escapeRegExp returns an empty string when passing falsy values

* Add parens around expression in escapeRegExp
This commit is contained in:
Luiz Américo
2019-08-22 20:08:13 -03:00
committed by John-David Dalton
parent 9971765d0c
commit 91c9cb1ea3
2 changed files with 1 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ const reHasRegExpChar = RegExp(reRegExpChar.source)
function escapeRegExp(string) {
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar, '\\$&')
: string
: (string || '')
}
export default escapeRegExp