Skip to content

Commit 91c9cb1

Browse files
blikblumjdalton
authored andcommitted
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
1 parent 9971765 commit 91c9cb1

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

escapeRegExp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const reHasRegExpChar = RegExp(reRegExpChar.source)
2222
function escapeRegExp(string) {
2323
return (string && reHasRegExpChar.test(string))
2424
? string.replace(reRegExpChar, '\\$&')
25-
: string
25+
: (string || '')
2626
}
2727

2828
export default escapeRegExp
File renamed without changes.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy