Skip to content

Commit

Permalink
add cyrillic ё and й (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
glebtv authored Nov 24, 2022
1 parent 88ed100 commit 68254de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ var characterMap = {
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};

var chars = Object.keys(characterMap).join('|');
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "0.4.3",
"description": "Converting the accented characters to their corresponding non-accented ASCII characters.",
"main": "index.js",
"dependencies": {

},
"dependencies": {},
"devDependencies": {
"tape": "^4.2.2"
},
Expand Down
12 changes: 11 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@ tape('remove accents from string', function(t) {
t.end();
});

tape('remove cyrillic accents from string', function(t) {
var input = 'ЁёЙй';
var output = removeAccents(input);
var expected = 'ЕеИи';

t.same( output, expected );

t.end();
});

tape('do not modify non-accented strings', function(t) {
var input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789.,:;~`!@#$%^&*()-_=+[]{}\'"|\\<>?/';
var input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789.,:;~`!@#$%^&*()-_=+[]{}\'"|\\<>?/eEиИ';
var output = removeAccents(input);

t.same( output, input );
Expand Down

0 comments on commit 68254de

Please # to comment.