File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 99 var repeating = / ^ ( .) \1+ $ /
1010 var glyph = / [ \u0300 - \u036f ] / g
1111 var norm = "" . normalize
12+ var base = norm ? bass : basic
1213
13- function grapheme ( txt ) {
14- return digit . test ( txt ) ? "" + txt :
15- norm . call ( txt , "NFD" ) . replace ( glyph , "" )
14+ function bass ( txt ) {
15+ return norm . call ( txt , "NFD" ) . replace ( glyph , "" )
16+ }
17+
18+ function basic ( txt ) {
19+ return "" + txt
1620 }
1721
1822 function modulo ( n ) {
2125 }
2226
2327 function place ( letter ) {
24- letter = grapheme ( lower . call ( letter ) )
28+ letter = base ( lower . call ( letter ) )
2529 return bet . indexOf ( letter ) + 1
2630 }
2731
6165 return api [ method ] ( txt )
6266 }
6367
64- api . grapheme = grapheme
68+ api . base = base
69+ api . bass = bass
70+ api . basic = basic
6571 api . life = vida
6672 api . modulo = modulo
6773 api . raiz = raiz
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ assert.ok(api.raiz("FF") === 3)
4242assert . ok ( api . raiz ( "firefox" ) === 2 )
4343console . log ( "ok raiz" )
4444
45- assert . ok ( api . grapheme ( "Áá" ) , "Aa" )
46- console . log ( "ok grapheme " )
45+ assert . ok ( api . base ( "Áá" ) , "Aa" )
46+ console . log ( "ok base " )
4747
4848assert . ok ( api . raiz === api . root )
4949assert . ok ( api . vida === api . life )
You can’t perform that action at this time.
0 commit comments