@thi.ng/transducers-binary 2.1.30 → 2.1.32
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 +7 -10
- package/api.d.ts +2 -2
- package/hex-dump.d.ts +9 -5
- package/package.json +13 -13
- package/random-bits.d.ts +5 -4
- package/random-bits.js +5 -4
- package/utf8.d.ts +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/transducers-binary)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -28,7 +28,7 @@ This project is part of the
|
|
|
28
28
|
|
|
29
29
|
## About
|
|
30
30
|
|
|
31
|
-
Binary data related transducers & reducers
|
|
31
|
+
Binary data related transducers & reducers
|
|
32
32
|
|
|
33
33
|
Like the transducers and reducers defined in
|
|
34
34
|
[@thi.ng/transducers](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers),
|
|
@@ -63,11 +63,8 @@ ES module import:
|
|
|
63
63
|
|
|
64
64
|
For Node.js REPL:
|
|
65
65
|
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
node --experimental-repl-await
|
|
69
|
-
|
|
70
|
-
> const transducersBinary = await import("@thi.ng/transducers-binary");
|
|
66
|
+
```js
|
|
67
|
+
const transducersBinary = await import("@thi.ng/transducers-binary");
|
|
71
68
|
```
|
|
72
69
|
|
|
73
70
|
Package sizes (brotli'd, pre-treeshake): ESM: 2.58 KB
|
|
@@ -306,7 +303,7 @@ tx.transduce(tx.comp(txb.base64Decode(), txb.utf8Decode()), tx.str(), buf);
|
|
|
306
303
|
|
|
307
304
|
## Authors
|
|
308
305
|
|
|
309
|
-
Karsten Schmidt
|
|
306
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
310
307
|
|
|
311
308
|
If this project contributes to an academic publication, please cite it as:
|
|
312
309
|
|
|
@@ -321,4 +318,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
321
318
|
|
|
322
319
|
## License
|
|
323
320
|
|
|
324
|
-
© 2018 - 2022 Karsten Schmidt // Apache
|
|
321
|
+
© 2018 - 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type Type = "i8" | "i8a" | "u8" | "u8a" | "i16" | "i16a" | "u16" | "u16a" | "i24" | "i24a" | "u24" | "u24a" | "i32" | "i32a" | "u32" | "u32a" | "f32" | "f32a" | "f64" | "f64a" | "str";
|
|
2
|
+
export type BinStructItem = ["i8", number] | ["i8a", ArrayLike<number>] | ["u8", number] | ["u8a", ArrayLike<number>] | ["i16", number, boolean?] | ["i16a", ArrayLike<number>, boolean?] | ["u16", number, boolean?] | ["u16a", ArrayLike<number>, boolean?] | ["i24", number, boolean?] | ["i24a", ArrayLike<number>, boolean?] | ["u24", number, boolean?] | ["u24a", ArrayLike<number>, boolean?] | ["i32", number, boolean?] | ["i32a", ArrayLike<number>, boolean?] | ["u32", number, boolean?] | ["u32a", ArrayLike<number>, boolean?] | ["f32", number, boolean?] | ["f32a", ArrayLike<number>, boolean?] | ["f64", number, boolean?] | ["f64a", ArrayLike<number>, boolean?] | ["str", string];
|
|
3
3
|
export interface HexDumpOpts {
|
|
4
4
|
/**
|
|
5
5
|
* Number of bytes per line.
|
package/hex-dump.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { Transducer } from "@thi.ng/transducers";
|
|
2
2
|
import type { HexDumpOpts } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transforms bytes into a sequence of hexdump lines with configurable
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* are only produced once filled. If the input hasn't
|
|
8
|
-
* of `cols` bytes, the last line will be padded with zeroes.
|
|
4
|
+
* Transforms bytes into a sequence of hexdump lines with configurable number of
|
|
5
|
+
* `columns` and `address` offset. Uses
|
|
6
|
+
* [`partition()`](https://docs.thi.ng/umbrella/transducers/functions/partition.html)
|
|
7
|
+
* internally, so new lines are only produced once filled. If the input hasn't
|
|
8
|
+
* an exact multiple of `cols` bytes, the last line will be padded with zeroes.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Also see alt implementation in
|
|
12
|
+
* [thi.ng/hex](https://docs.thi.ng/umbrella/hex/functions/hexdump.html)
|
|
9
13
|
*
|
|
10
14
|
* @example
|
|
11
15
|
* ```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transducers-binary",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.32",
|
|
4
4
|
"description": "Binary data related transducers & reducers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/binary": "^3.3.
|
|
38
|
-
"@thi.ng/compose": "^2.1.
|
|
39
|
-
"@thi.ng/errors": "^2.2.
|
|
40
|
-
"@thi.ng/hex": "^2.3.
|
|
41
|
-
"@thi.ng/random": "^3.3.
|
|
42
|
-
"@thi.ng/transducers": "^8.3.
|
|
37
|
+
"@thi.ng/binary": "^3.3.14",
|
|
38
|
+
"@thi.ng/compose": "^2.1.22",
|
|
39
|
+
"@thi.ng/errors": "^2.2.6",
|
|
40
|
+
"@thi.ng/hex": "^2.3.2",
|
|
41
|
+
"@thi.ng/random": "^3.3.19",
|
|
42
|
+
"@thi.ng/transducers": "^8.3.27"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.33.
|
|
46
|
-
"@thi.ng/testament": "^0.3.
|
|
45
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
46
|
+
"@thi.ng/testament": "^0.3.7",
|
|
47
47
|
"rimraf": "^3.0.2",
|
|
48
48
|
"tools": "^0.0.1",
|
|
49
|
-
"typedoc": "^0.23.
|
|
50
|
-
"typescript": "^4.
|
|
49
|
+
"typedoc": "^0.23.22",
|
|
50
|
+
"typescript": "^4.9.4"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"array",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
],
|
|
113
113
|
"year": 2018
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
116
116
|
}
|
package/random-bits.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { IRandom } from "@thi.ng/random";
|
|
2
2
|
/**
|
|
3
|
-
* Returns an iterator of random bits, with 1's occurring w/ given
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Returns an iterator of random bits, with 1's occurring w/ given probability
|
|
4
|
+
* `prob` (in the [0,1] interval). If `num` is given, only that many bits will
|
|
5
|
+
* be produced.
|
|
6
6
|
*
|
|
7
7
|
* By default, uses system PRNG, but a custom
|
|
8
|
-
*
|
|
8
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html) impl
|
|
9
|
+
* can be provided via `rnd` arg.
|
|
9
10
|
*
|
|
10
11
|
* @param prob -
|
|
11
12
|
* @param num -
|
package/random-bits.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SYSTEM } from "@thi.ng/random/system";
|
|
2
2
|
import { repeatedly } from "@thi.ng/transducers/repeatedly";
|
|
3
3
|
/**
|
|
4
|
-
* Returns an iterator of random bits, with 1's occurring w/ given
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Returns an iterator of random bits, with 1's occurring w/ given probability
|
|
5
|
+
* `prob` (in the [0,1] interval). If `num` is given, only that many bits will
|
|
6
|
+
* be produced.
|
|
7
7
|
*
|
|
8
8
|
* By default, uses system PRNG, but a custom
|
|
9
|
-
*
|
|
9
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html) impl
|
|
10
|
+
* can be provided via `rnd` arg.
|
|
10
11
|
*
|
|
11
12
|
* @param prob -
|
|
12
13
|
* @param num -
|
package/utf8.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Transducer } from "@thi.ng/transducers";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer which decodes a byte input sequence into UTF-8 characters.
|
|
4
|
-
*
|
|
3
|
+
* Transducer which decodes a byte input sequence into UTF-8 characters. Also
|
|
4
|
+
* see {@link utf8Encode} for reverse transformation.
|
|
5
5
|
*/
|
|
6
6
|
export declare function utf8Decode(): Transducer<number, string>;
|
|
7
7
|
export declare function utf8Decode(src: Iterable<number>): string;
|
|
8
8
|
/**
|
|
9
9
|
* Transducer which encodes UTF-8 characters into a byte sequence.
|
|
10
10
|
*
|
|
11
|
-
* Also see {@link
|
|
11
|
+
* Also see {@link utf8Decode} for reverse transformation.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|