@vandeurenglenn/base16 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +4 -4
- package/package.json +1 -1
- package/src/index.ts +5 -5
- package/tsconfig.json +1 -0
- package/dist/base32.js +0 -35
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import baseX from '@vandeurenglenn/base-x';
|
|
2
2
|
|
|
3
|
-
const ALPHABET = '
|
|
4
|
-
const
|
|
5
|
-
const decode =
|
|
6
|
-
const encode =
|
|
3
|
+
const ALPHABET = '0123456789ABCDEF';
|
|
4
|
+
const base16 = baseX(ALPHABET);
|
|
5
|
+
const decode = base16.decode;
|
|
6
|
+
const encode = base16.encode;
|
|
7
7
|
const isBase16 = (string) => {
|
|
8
8
|
try {
|
|
9
9
|
decode(string);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import baseX from '@vandeurenglenn/base-x'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A base16String only contains [0-9][
|
|
4
|
+
* A base16String only contains [0-9][A-F]
|
|
5
5
|
*/
|
|
6
6
|
type base16String = string
|
|
7
7
|
|
|
8
|
-
const ALPHABET = '
|
|
8
|
+
const ALPHABET = '0123456789ABCDEF'
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const base16 = baseX(ALPHABET)
|
|
11
11
|
|
|
12
|
-
export const decode =
|
|
12
|
+
export const decode = base16.decode
|
|
13
13
|
|
|
14
|
-
export const encode =
|
|
14
|
+
export const encode = base16.encode
|
|
15
15
|
|
|
16
16
|
export const isBase16 = (string: base16String): boolean => {
|
|
17
17
|
try {
|
package/tsconfig.json
CHANGED
package/dist/base32.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import baseX from '@vandeurenglenn/base-x';
|
|
2
|
-
|
|
3
|
-
const ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567';
|
|
4
|
-
const ALPHABET_HEX = '0123456789abcdefghijklmnopqrstuv';
|
|
5
|
-
const base32 = baseX(ALPHABET);
|
|
6
|
-
const base32Hex = baseX(ALPHABET_HEX);
|
|
7
|
-
const decode = base32.decode;
|
|
8
|
-
const decodeHex = base32Hex.decode;
|
|
9
|
-
const encode = base32.encode;
|
|
10
|
-
const encodeHex = base32Hex.encode;
|
|
11
|
-
const isBase32 = (string, hex = false) => {
|
|
12
|
-
try {
|
|
13
|
-
if (hex)
|
|
14
|
-
decodeHex(string);
|
|
15
|
-
else
|
|
16
|
-
decode(string);
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const isBase32Hex = (string) => {
|
|
24
|
-
return isBase32(string, true);
|
|
25
|
-
};
|
|
26
|
-
var base32$1 = {
|
|
27
|
-
encode,
|
|
28
|
-
decode,
|
|
29
|
-
encodeHex,
|
|
30
|
-
decodeHex,
|
|
31
|
-
isBase32,
|
|
32
|
-
isBase32Hex
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export { decode, decodeHex, base32$1 as default, encode, encodeHex, isBase32, isBase32Hex };
|