@thi.ng/bitstream 2.3.0 → 2.4.0
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 +8 -1
- package/package.json +2 -2
- package/simple.d.ts +18 -0
- package/simple.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-08-
|
|
3
|
+
- **Last updated**: 2024-08-23T16:18:16Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/bitstream@2.4.0) (2024-08-23)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add read16/24/32() fns ([edf19e7](https://github.com/thi-ng/umbrella/commit/edf19e7))
|
|
17
|
+
- add tests
|
|
18
|
+
|
|
12
19
|
## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/bitstream@2.3.0) (2024-08-19)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/bitstream",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "ES6 iterator based read/write bit streams with support for variable word widths",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"rle-pack"
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "0d01681c64f5459647ab06f197f70dc90fb64cc9\n"
|
|
85
85
|
}
|
package/simple.d.ts
CHANGED
|
@@ -23,4 +23,22 @@ export declare const bitWriter: (capacity?: number) => {
|
|
|
23
23
|
* @param buf
|
|
24
24
|
*/
|
|
25
25
|
export declare const bitReader: (buf: Uint8Array | number[]) => (n?: number) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Wrapper for {@link bitReader} to read a 16bit word (big endian)
|
|
28
|
+
*
|
|
29
|
+
* @param read
|
|
30
|
+
*/
|
|
31
|
+
export declare const read16: (read: (n: number) => number) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Wrapper for {@link bitReader} to read a 24bit word (big endian)
|
|
34
|
+
*
|
|
35
|
+
* @param read
|
|
36
|
+
*/
|
|
37
|
+
export declare const read24: (read: (n: number) => number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Wrapper for {@link bitReader} to read a 32bit word (big endian, unsigned)
|
|
40
|
+
*
|
|
41
|
+
* @param read
|
|
42
|
+
*/
|
|
43
|
+
export declare const read32: (read: (n: number) => number) => number;
|
|
26
44
|
//# sourceMappingURL=simple.d.ts.map
|
package/simple.js
CHANGED
|
@@ -54,7 +54,13 @@ const bitReader = (buf) => {
|
|
|
54
54
|
return out;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
+
const read16 = (read) => read(8) << 8 | read(8);
|
|
58
|
+
const read24 = (read) => read16(read) << 8 | read(8);
|
|
59
|
+
const read32 = (read) => (read16(read) << 16 | read16(read)) >>> 0;
|
|
57
60
|
export {
|
|
58
61
|
bitReader,
|
|
59
|
-
bitWriter
|
|
62
|
+
bitWriter,
|
|
63
|
+
read16,
|
|
64
|
+
read24,
|
|
65
|
+
read32
|
|
60
66
|
};
|