generated from s9a/zero
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create pattern * esta aqui
- Loading branch information
Showing
3 changed files
with
87 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,99 @@ | ||
!function(scope) { | ||
var latin = "abcdefghijklmnopqrstuvwxyz" | ||
var bet = latin | ||
var join = "".join | ||
var split = "".split | ||
var lower = "".toLowerCase | ||
var digit = /^\d+$/ | ||
var round = Math.round | ||
var repeating = /^(.)\1+$/ | ||
var glyph = /[\u0300-\u036f]/g | ||
var norm = "".normalize | ||
var base = norm ? bass : basic | ||
!function(esta) { | ||
var api = create() | ||
var nombre = "numerologia" | ||
typeof module != "undefined" && module.exports | ||
? module.exports = api | ||
: esta[nombre] = api | ||
|
||
function bass(txt) { | ||
return norm.call(txt, "NFD").replace(glyph, "") | ||
} | ||
function create(bet) { | ||
var latin = "abcdefghijklmnopqrstuvwxyz" | ||
var join = "".join | ||
var split = "".split | ||
var lower = "".toLowerCase | ||
var digit = /^\d+$/ | ||
var round = Math.round | ||
var repeating = /^(.)\1+$/ | ||
var glyph = /[\u0300-\u036f]/g | ||
var norm = "".normalize | ||
var base = norm ? bass : basic | ||
bet = bet ? lower.call(bet) : latin | ||
|
||
function basic(txt) { | ||
return "" + txt | ||
} | ||
function bass(txt) { | ||
return norm.call(txt, "NFD").replace(glyph, "") | ||
} | ||
|
||
function key(n) { | ||
return modulo(digit.test(n) ? n : place(n)) | ||
} | ||
function basic(txt) { | ||
return "" + txt | ||
} | ||
|
||
function modulo(n) { | ||
return +n ? n % 9 || 9 : 0 | ||
} | ||
function key(n) { | ||
return modulo(digit.test(n) ? n : place(n)) | ||
} | ||
|
||
function place(letter) { | ||
letter = base(lower.call(letter)) | ||
return bet.indexOf(letter) + 1 | ||
} | ||
function modulo(n) { | ||
return +n ? n % 9 || 9 : 0 | ||
} | ||
|
||
function stack(txt) { | ||
var how = txt instanceof Array ? join : split | ||
return how.call(txt, "") | ||
} | ||
function place(letter) { | ||
letter = base(lower.call(letter)) | ||
return bet.indexOf(letter) + 1 | ||
} | ||
|
||
function suma(txt) { | ||
txt = stack(txt) | ||
var i = txt.length | ||
var suma = 0 | ||
var next | ||
while (i--) { | ||
next = txt[i] | ||
next = key(next) | ||
suma += next > 0 ? +next : 0 | ||
function stack(txt) { | ||
var how = txt instanceof Array ? join : split | ||
return how.call(txt, "") | ||
} | ||
return round(suma) | ||
} | ||
|
||
function raiz(txt) { | ||
var n = suma(txt) | ||
return n < 10 ? n : raiz(n) | ||
} | ||
function suma(txt) { | ||
txt = stack(txt) | ||
var i = txt.length | ||
var suma = 0 | ||
var next | ||
while (i--) { | ||
next = txt[i] | ||
next = key(next) | ||
suma += next > 0 ? +next : 0 | ||
} | ||
return round(suma) | ||
} | ||
|
||
function numero(txt) { | ||
var n = suma(txt) | ||
return n < 10 || rep(n) ? n : numero(n) | ||
} | ||
function raiz(txt) { | ||
var n = suma(txt) | ||
return n < 10 ? n : raiz(n) | ||
} | ||
|
||
function rep(dig) { | ||
return repeating.test(dig) | ||
} | ||
function numero(txt) { | ||
var n = suma(txt) | ||
return n < 10 || rep(n) ? n : numero(n) | ||
} | ||
|
||
function api(method, txt) { | ||
return api[method](txt) | ||
} | ||
function rep(dig) { | ||
return repeating.test(dig) | ||
} | ||
|
||
api.base = base | ||
api.bass = bass | ||
api.basic = basic | ||
api.key = key | ||
api.modulo = modulo | ||
api.num = numero | ||
api.numero = numero | ||
api.place = place | ||
api.raiz = raiz | ||
api.rep = rep | ||
api.root = raiz | ||
api.sum = suma | ||
api.suma = suma | ||
function rep(dig) { | ||
return repeating.test(dig) | ||
} | ||
|
||
typeof module != "undefined" && module.exports | ||
? module.exports = api | ||
: scope.numerologia = api | ||
function api(method, txt) { | ||
return api[method](txt) | ||
} | ||
|
||
api.base = base | ||
api.bass = bass | ||
api.basic = basic | ||
api.create = create | ||
api.key = key | ||
api.modulo = modulo | ||
api.num = numero | ||
api.numero = numero | ||
api.place = place | ||
api.raiz = raiz | ||
api.rep = rep | ||
api.root = raiz | ||
api.sum = suma | ||
api.suma = suma | ||
|
||
return api | ||
} | ||
}(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters