UNPKG
iota-converter
Version:
latest (0.1.4)
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Converts between trytes, trits and bytes
github.com/alexpods/iota-converter
alexpods/iota-converter
iota-converter
/
src
/
trytes-to-number.ts
14 lines
(9 loc)
•
261 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
{
TRYTES_TO_NUMBERS
}
from
'./constants'
export
function
trytesToNumber
(
trytes
:
string
):
number
{
var
i, result result =
0
for
(i = trytes.
length
-
1
; i >=
0
; --i) { result = result *
27
+
TRYTES_TO_NUMBERS
[trytes[i]] }
return
result }