@thi.ng/hex 2.1.1 → 2.1.4
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/CHANGELOG.md +1 -1
- package/README.md +2 -2
- package/index.d.ts +7 -7
- package/index.js +7 -7
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ node --experimental-repl-await
|
|
|
55
55
|
> const hex = await import("@thi.ng/hex");
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
58
|
+
Package sizes (gzipped, pre-treeshake): ESM: 370 bytes
|
|
59
59
|
|
|
60
60
|
## Dependencies
|
|
61
61
|
|
|
@@ -122,4 +122,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
122
122
|
|
|
123
123
|
## License
|
|
124
124
|
|
|
125
|
-
© 2020 -
|
|
125
|
+
© 2020 - 2022 Karsten Schmidt // Apache Software License 2.0
|
package/index.d.ts
CHANGED
|
@@ -5,13 +5,13 @@ export declare const HEX = "0123456789abcdef";
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns 4bit uint as hex string
|
|
7
7
|
*
|
|
8
|
-
* @param x
|
|
8
|
+
* @param x -
|
|
9
9
|
*/
|
|
10
10
|
export declare const U4: (x: number) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Returns 8bit uint as hex string
|
|
13
13
|
*
|
|
14
|
-
* @param x
|
|
14
|
+
* @param x -
|
|
15
15
|
*/
|
|
16
16
|
export declare const U8: (x: number) => string;
|
|
17
17
|
/**
|
|
@@ -24,7 +24,7 @@ export declare const U8A: (x: ArrayLike<number>, i: number) => string;
|
|
|
24
24
|
/**
|
|
25
25
|
* Returns 16bit uint as hex string
|
|
26
26
|
*
|
|
27
|
-
* @param x
|
|
27
|
+
* @param x -
|
|
28
28
|
*/
|
|
29
29
|
export declare const U16: (x: number) => string;
|
|
30
30
|
/**
|
|
@@ -46,7 +46,7 @@ export declare const U16LE: (x: ArrayLike<number>, i: number) => string;
|
|
|
46
46
|
/**
|
|
47
47
|
* Returns 24bit uint as hex string
|
|
48
48
|
*
|
|
49
|
-
* @param x
|
|
49
|
+
* @param x -
|
|
50
50
|
*/
|
|
51
51
|
export declare const U24: (x: number) => string;
|
|
52
52
|
/**
|
|
@@ -68,7 +68,7 @@ export declare const U24LE: (x: ArrayLike<number>, i: number) => string;
|
|
|
68
68
|
/**
|
|
69
69
|
* Returns 32bit uint as hex string
|
|
70
70
|
*
|
|
71
|
-
* @param x
|
|
71
|
+
* @param x -
|
|
72
72
|
*/
|
|
73
73
|
export declare const U32: (x: number) => string;
|
|
74
74
|
/**
|
|
@@ -90,7 +90,7 @@ export declare const U32LE: (x: ArrayLike<number>, i: number) => string;
|
|
|
90
90
|
/**
|
|
91
91
|
* Returns 48bit uint as hex string
|
|
92
92
|
*
|
|
93
|
-
* @param x
|
|
93
|
+
* @param x -
|
|
94
94
|
*/
|
|
95
95
|
export declare const U48: (x: number) => string;
|
|
96
96
|
/**
|
|
@@ -124,7 +124,7 @@ export declare const U48LE: (x: ArrayLike<number>, i: number) => string;
|
|
|
124
124
|
* {@link U64BE} or {@link U64LE} for byte array based values (full 64bit range
|
|
125
125
|
* supported). Alternatively, use `BigInt(x).toString(16)`.
|
|
126
126
|
*
|
|
127
|
-
* @param x
|
|
127
|
+
* @param x -
|
|
128
128
|
*/
|
|
129
129
|
export declare const U64: (x: number) => string;
|
|
130
130
|
/**
|
package/index.js
CHANGED
|
@@ -6,13 +6,13 @@ export const HEX = "0123456789abcdef";
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns 4bit uint as hex string
|
|
8
8
|
*
|
|
9
|
-
* @param x
|
|
9
|
+
* @param x -
|
|
10
10
|
*/
|
|
11
11
|
export const U4 = (x) => HEX[x & 0xf];
|
|
12
12
|
/**
|
|
13
13
|
* Returns 8bit uint as hex string
|
|
14
14
|
*
|
|
15
|
-
* @param x
|
|
15
|
+
* @param x -
|
|
16
16
|
*/
|
|
17
17
|
export const U8 = (x) => HEX[(x >>> 4) & 0xf] + HEX[x & 0xf];
|
|
18
18
|
/**
|
|
@@ -25,7 +25,7 @@ export const U8A = (x, i) => U8(x[i]);
|
|
|
25
25
|
/**
|
|
26
26
|
* Returns 16bit uint as hex string
|
|
27
27
|
*
|
|
28
|
-
* @param x
|
|
28
|
+
* @param x -
|
|
29
29
|
*/
|
|
30
30
|
export const U16 = (x) => U8(x >>> 8) + U8(x & 0xff);
|
|
31
31
|
/**
|
|
@@ -47,7 +47,7 @@ export const U16LE = (x, i) => U8(x[i + 1]) + U8(x[i]);
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns 24bit uint as hex string
|
|
49
49
|
*
|
|
50
|
-
* @param x
|
|
50
|
+
* @param x -
|
|
51
51
|
*/
|
|
52
52
|
export const U24 = (x) => U8(x >>> 16) + U16(x);
|
|
53
53
|
/**
|
|
@@ -69,7 +69,7 @@ export const U24LE = (x, i) => U8(x[i + 2]) + U16LE(x, i);
|
|
|
69
69
|
/**
|
|
70
70
|
* Returns 32bit uint as hex string
|
|
71
71
|
*
|
|
72
|
-
* @param x
|
|
72
|
+
* @param x -
|
|
73
73
|
*/
|
|
74
74
|
export const U32 = (x) => U16(x >>> 16) + U16(x);
|
|
75
75
|
/**
|
|
@@ -91,7 +91,7 @@ export const U32LE = (x, i) => U16LE(x, i + 2) + U16LE(x, i);
|
|
|
91
91
|
/**
|
|
92
92
|
* Returns 48bit uint as hex string
|
|
93
93
|
*
|
|
94
|
-
* @param x
|
|
94
|
+
* @param x -
|
|
95
95
|
*/
|
|
96
96
|
export const U48 = (x) => U48HL(x / P32, x % P32);
|
|
97
97
|
/**
|
|
@@ -125,7 +125,7 @@ export const U48LE = (x, i) => U16LE(x, i + 4) + U32LE(x, i);
|
|
|
125
125
|
* {@link U64BE} or {@link U64LE} for byte array based values (full 64bit range
|
|
126
126
|
* supported). Alternatively, use `BigInt(x).toString(16)`.
|
|
127
127
|
*
|
|
128
|
-
* @param x
|
|
128
|
+
* @param x -
|
|
129
129
|
*/
|
|
130
130
|
export const U64 = (x) => U64HL(x / P32, x % P32);
|
|
131
131
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/hex",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Hex string formatters for 4/8/16/24/32/48/64bit words",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@microsoft/api-extractor": "^7.
|
|
38
|
-
"@thi.ng/testament": "^0.2.
|
|
37
|
+
"@microsoft/api-extractor": "^7.19.4",
|
|
38
|
+
"@thi.ng/testament": "^0.2.4",
|
|
39
39
|
"rimraf": "^3.0.2",
|
|
40
40
|
"tools": "^0.0.1",
|
|
41
|
-
"typedoc": "^0.22.
|
|
42
|
-
"typescript": "^4.
|
|
41
|
+
"typedoc": "^0.22.13",
|
|
42
|
+
"typescript": "^4.6.2"
|
|
43
43
|
},
|
|
44
44
|
"keywords": [
|
|
45
45
|
"binary",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
],
|
|
70
70
|
"year": 2020
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "0fc692a3225c068aacafdc4cb6140cf603c67ad8\n"
|
|
73
73
|
}
|