Skip to content

Commit 461eec0

Browse files
authored
base bass basic (#11)
1 parent 3f2e876 commit 461eec0

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

api.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
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) {
@@ -21,7 +25,7 @@
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

@@ -61,7 +65,9 @@
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

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ assert.ok(api.raiz("FF") === 3)
4242
assert.ok(api.raiz("firefox") === 2)
4343
console.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

4848
assert.ok(api.raiz === api.root)
4949
assert.ok(api.vida === api.life)

0 commit comments

Comments
 (0)