@thi.ng/bitstream 2.3.0 → 2.4.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-08-19T13:45:57Z
3
+ - **Last updated**: 2024-08-28T14:01:19Z
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/README.md CHANGED
@@ -67,7 +67,7 @@ For Node.js REPL:
67
67
  const bit = await import("@thi.ng/bitstream");
68
68
  ```
69
69
 
70
- Package sizes (brotli'd, pre-treeshake): ESM: 1.35 KB
70
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.40 KB
71
71
 
72
72
  ## Dependencies
73
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/bitstream",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
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": "bfbc227cf5ca2d3c2984b3d4713eebd6225cbd54\n"
84
+ "gitHead": "502a0192bae48e69290870ea8a2767f8b81adee6\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
  };