diff --git a/api.js b/api.js index 7d6a4f7..7d72747 100644 --- a/api.js +++ b/api.js @@ -9,10 +9,14 @@ var repeating = /^(.)\1+$/ var glyph = /[\u0300-\u036f]/g var norm = "".normalize + var base = norm ? bass : basic - function grapheme(txt) { - return digit.test(txt) ? "" + txt : - norm.call(txt, "NFD").replace(glyph, "") + function bass(txt) { + return norm.call(txt, "NFD").replace(glyph, "") + } + + function basic(txt) { + return "" + txt } function modulo(n) { @@ -21,7 +25,7 @@ } function place(letter) { - letter = grapheme(lower.call(letter)) + letter = base(lower.call(letter)) return bet.indexOf(letter) + 1 } @@ -61,7 +65,9 @@ return api[method](txt) } - api.grapheme = grapheme + api.base = base + api.bass = bass + api.basic = basic api.life = vida api.modulo = modulo api.raiz = raiz diff --git a/test.js b/test.js index 3d415f7..f01f647 100644 --- a/test.js +++ b/test.js @@ -42,8 +42,8 @@ assert.ok(api.raiz("FF") === 3) assert.ok(api.raiz("firefox") === 2) console.log("ok raiz") -assert.ok(api.grapheme("Áá"), "Aa") -console.log("ok grapheme") +assert.ok(api.base("Áá"), "Aa") +console.log("ok base") assert.ok(api.raiz === api.root) assert.ok(api.vida === api.life)