lodash / lodash-webpack-plugin

Smaller modular Lodash builds.
Other
1.19k stars 63 forks source link

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

Closed ElMassimo closed 5 years ago

ElMassimo commented 5 years ago

Found the problem through Webpack non-deterministic builds as described in https://github.com/lodash/lodash-webpack-plugin/issues/162, this pull request fixes a change in behavior in all functions that depend on createCompounder when deburring is not enabled:

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 commented 5 years ago

CLA assistant check
All committers have signed the CLA.

jdalton commented 5 years ago

Thank you @ElMassimo!