Skip to content

Commit

Permalink
correctly handle empty strings in charmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
iliazeus committed Mar 23, 2023
1 parent 4c927b6 commit a8b2b1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions slugify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions test/slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,13 @@ describe('slugify', () => {
it('should preserve leading/trailing replacement characters if option set', function () {
t.equal(slugify(' foo bar baz ', { trim: false }), '-foo-bar-baz-')
})

it('should correctly handle empty strings in charmaps', () => {
slugify.extend({ 'ъ': '' })
t.equal(slugify('ъяъ'), 'ya')
t.equal(slugify('ъяъ', { remove: /[]/g }), 'ya')

delete require.cache[require.resolve('../')]
slugify = require('../')
})
})

0 comments on commit a8b2b1a

Please sign in to comment.