Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Fix behavior change for createCompounder when deburring is not enabled #163

Merged
merged 1 commit into from
Jul 26, 2019

Conversation

ElMassimo
Copy link
Contributor

@ElMassimo ElMassimo commented Jul 24, 2019

Found the problem through Webpack non-deterministic builds as described in #162, this pull request fixes a change in behavior in all functions that depend on createCompounder when deburring is not enabled:

  • camelCase
  • kebabCase
  • lowerCase
  • snakeCase
  • startCase
  • upperCase

Assuming these functions are expected to work with non-String arguments, such as null or {}, since that's the behavior in the full build of the library.

The Bug 🐞

When deburring is disabled, deburr will be replaced with identity, failing to coerce the argument to a String as it normally would, so createCompounder fails when calling replace if the function was called with any non-String argument.

The Fix 🔨

Substitute deburr with toString instead when deburring is disabled. This will ensure any arguments are coerced as usual, but no regex replacement will occur.

@jsf-clabot
Copy link

jsf-clabot commented Jul 24, 2019

CLA assistant check
All committers have signed the CLA.

@jdalton
Copy link
Member

jdalton commented Jul 26, 2019

Thank you @ElMassimo!

@jdalton jdalton merged commit 8e1ef29 into lodash:master Jul 26, 2019
@ElMassimo ElMassimo deleted the fix-create-compounder branch July 29, 2019 13:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants