The Wayback Machine - https://web.archive.org/web/20201220220740/https://github.com/lodash/lodash/pull/4432
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Aug 22, 2019

Conversation

@blikblum
Copy link
Contributor

@blikblum blikblum commented Aug 21, 2019

Fix test passing falsy values

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

This comment has been minimized.

@jdalton

jdalton Aug 22, 2019
Member

can you wrap string || '' in parens please.

This comment has been minimized.

@blikblum

blikblum Aug 22, 2019
Author Contributor

can you wrap string || '' in parens please.

Done

@jdalton jdalton added the bug label Aug 22, 2019
@jdalton
Copy link
Member

@jdalton jdalton commented Aug 22, 2019

Rock! Thank you @blikblum!

@jdalton jdalton merged commit 91c9cb1 into lodash:master Aug 22, 2019
1 check passed
1 check passed
licence/cla Contributor License Agreement is signed.
Details
@blikblum blikblum deleted the blikblum:fix-escaperegex branch Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.