Skip to content

fix: treat null mappings from extend() as character removal - #216

Open
felbones wants to merge 1 commit into
simov:masterfrom
felbones:fix/extend-null-character-removal
Open

fix: treat null mappings from extend() as character removal#216
felbones wants to merge 1 commit into
simov:masterfrom
felbones:fix/extend-null-character-removal

Conversation

@felbones

@felbones felbones commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Fix slugify.extend({ '%': null }) throwing a TypeError: Cannot read properties of null (reading 'replace').

Motivation

Passing null as a value in slugify.extend() is intended to remove the character during slugification, but previously caused a runtime crash when calling .replace() on null.

Implementation

Coerce null character mappings to an empty string '' during the reduce step.

Testing

Added regression unit test in test/slugify.js. All 46 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant