Skip to content

fix: share character mappings with the default export - #222

Open
feritcemkahraman wants to merge 1 commit into
simov:masterfrom
feritcemkahraman:fix/shared-default-character-map
Open

feritcemkahraman wants to merge 1 commit into
simov:masterfrom
feritcemkahraman:fix/shared-default-character-map

Conversation

@feritcemkahraman

Copy link
Copy Markdown

require('slugify').extend({'@': 'at-sign'}) does not affect require('slugify').default('@'): the CommonJS wrapper creates two separate functions and character maps. This also breaks the documented process-wide scope of extend() when import styles are mixed.

Make default reference the existing export. The regression checks extensions in both directions and resets the module cache afterward.

Validation: the new regression failed before the fix. npm test passes the build and all 46 tests afterward; npm run test:cov reports 100% function coverage. Syntax and diff checks pass (Node 24). AMD/browser and older Node versions were not run.

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