Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions config/charmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"©": "(c)",
"ª": "a",
"®": "(r)",
"²": "2",
"³": "3",
"¹": "1",
"º": "o",
"À": "A",
"Á": "A",
Expand Down Expand Up @@ -179,7 +182,10 @@
"Ț": "T",
"ț": "t",
"ə": "e",
"ʰ": "h",
"ʳ": "r",
"˚": "o",
"ˢ": "s",
"Ά": "A",
"Έ": "E",
"Ή": "H",
Expand Down Expand Up @@ -492,6 +498,8 @@
"ხ": "kh",
"ჯ": "j",
"ჰ": "h",
"ᵈ": "d",
"ᵗ": "t",
"Ṣ": "S",
"ṣ": "s",
"Ẁ": "W",
Expand Down Expand Up @@ -600,6 +608,24 @@
"†": "+",
"•": "*",
"…": "...",
"⁰": "0",
"⁴": "4",
"⁵": "5",
"⁶": "6",
"⁷": "7",
"⁸": "8",
"⁹": "9",
"ⁿ": "n",
"₀": "0",
"₁": "1",
"₂": "2",
"₃": "3",
"₄": "4",
"₅": "5",
"₆": "6",
"₇": "7",
"₈": "8",
"₉": "9",
"₠": "ecu",
"₢": "cruzeiro",
"₣": "french franc",
Expand Down
2 changes: 1 addition & 1 deletion slugify.js

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

8 changes: 8 additions & 0 deletions test/slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ describe('slugify', () => {
t.equal(slugify('foo_bar. -@-baz!', {strict: true}), 'foobar-baz')
})

it('transliterates common superscript and subscript characters', () => {
t.equal(slugify('15 m³'), '15-m3')
t.equal(slugify('H₂O'), 'H2O')
t.equal(slugify('¹²³ ⁰⁴⁵⁶⁷⁸⁹'), '123-0456789')
t.equal(slugify('₀₁₂₃₄₅₆₇₈₉'), '0123456789')
t.equal(slugify('1ˢᵗ 2ⁿᵈ 3ʳᵈ 4ᵗʰ'), '1st-2nd-3rd-4th')
})

it('options.strict - remove duplicates of the replacement character', () => {
t.equal(slugify('foo @ bar', {strict: true}), 'foo-bar')
})
Expand Down