@@ -3,7 +3,7 @@ const encode = (input, options) => {
3
3
throw Error ( 'Key is too short! It must be at least 3 characters' )
4
4
}
5
5
6
- const heyKey = [ ...options . key ] . map ( reduceToHexCharCodeConcatenationNumber )
6
+ const heyKey = [ ...options . key ] . map ( toHexCharCodeConcatenationNumber )
7
7
8
8
const chunkedString = input . match ( new RegExp ( `.{1,${ Math . round ( options . key . length / 2 ) } }` , 'g' ) )
9
9
@@ -25,7 +25,7 @@ const encode = (input, options) => {
25
25
acc *= 0.01 * heyKey [ i ]
26
26
}
27
27
return acc
28
- } , reduceToHexCharCodeConcatenationNumber ( s ) )
28
+ } , toHexCharCodeConcatenationNumber ( s ) )
29
29
) . join ( options . isAer256 ? ', ' : '+' )
30
30
}
31
31
@@ -34,7 +34,7 @@ const decode = (input, options) => {
34
34
throw Error ( 'Key is too short! It must be at least 3 characters' )
35
35
}
36
36
37
- const hexKey = [ ...options . key ] . map ( reduceToHexCharCodeConcatenationNumber )
37
+ const hexKey = [ ...options . key ] . map ( toHexCharCodeConcatenationNumber )
38
38
39
39
const keyLengthRangeReversed = Array . from ( new Array ( options . key . length ) , ( v , i ) => i ) . reverse ( )
40
40
@@ -69,7 +69,7 @@ const decode = (input, options) => {
69
69
* Map each character to hex representation of it's char code, join them together and then retrieve a decimal number
70
70
* out of the concatenated hex string.
71
71
*/
72
- const reduceToHexCharCodeConcatenationNumber = c => parseInt ( [ ...c ] . map ( x => {
72
+ const toHexCharCodeConcatenationNumber = c => parseInt ( [ ...c ] . map ( x => {
73
73
const hexCharCode = x . charCodeAt ( 0 ) . toString ( 16 )
74
74
if ( hexCharCode . length > 2 ) {
75
75
throw Error ( 'Invalid character' )
0 commit comments