Skip to content

Commit

Permalink
feat: add support for Georgian characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed May 28, 2020
1 parent 2a35bb6 commit 65d21f8
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
34 changes: 34 additions & 0 deletions slug.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,40 @@
: 'Ya',
य़: 'Yi',
ज़: 'Za',
// georgian
: 'a',
: 'b',
: 'g',
: 'd',
: 'e',
: 'v',
: 'z',
: 't',
: 'i',
: 'k',
: 'l',
: 'm',
: 'n',
: 'o',
: 'p',
: 'zh',
: 'r',
: 's',
: 't',
: 'u',
: 'p',
: 'k',
: 'gh',
: 'q',
: 'sh',
: 'ch',
: 'ts',
: 'dz',
: 'ts',
: 'ch',
: 'kh',
: 'j',
: 'h',
// currency
'€': 'euro',
'₢': 'cruzeiro',
Expand Down
42 changes: 42 additions & 0 deletions test/slug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,48 @@ describe('slug', function () {
}
})

it('should replace georgian chars', function () {
const charMap = {
: 'a',
: 'b',
: 'g',
: 'd',
: 'e',
: 'v',
: 'z',
: 't',
: 'i',
: 'k',
: 'l',
: 'm',
: 'n',
: 'o',
: 'p',
: 'zh',
: 'r',
: 's',
: 't',
: 'u',
: 'p',
: 'k',
: 'gh',
: 'q',
: 'sh',
: 'ch',
: 'ts',
: 'dz',
: 'ts',
: 'ch',
: 'kh',
: 'j',
: 'h'
}
for (const char in charMap) {
const replacement = charMap[char]
assert.strictEqual(slug(`foo ${char} bar baz`), `foo-${replacement}-bar-baz`.toLowerCase(), `replacing '${char}'`)
}
})

it('should replace bulgarian chars if locale provided', function () {
const charMap = {
A: 'A',
Expand Down

0 comments on commit 65d21f8

Please sign in to comment.