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.
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
whendeburring
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 withidentity
, failing to coerce the argument to aString
as it normally would, socreateCompounder
fails when callingreplace
if the function was called with any non-String argument.The Fix 🔨
Substitute
deburr
withtoString
instead whendeburring
is disabled. This will ensure any arguments are coerced as usual, but no regex replacement will occur.