@thi.ng/transducers-binary 2.1.78 → 2.1.79

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**: 2023-11-09T10:28:19Z
3
+ - **Last updated**: 2023-11-24T09:35:46Z
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.1.79](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers-binary@2.1.79) (2023-11-24)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update utf8 fns ([9e8cf2d](https://github.com/thi-ng/umbrella/commit/9e8cf2d))
17
+ - deprecate utf8Length() (migrated to [@thi.ng/strings](https://github.com/thi-ng/umbrella/tree/main/packages/strings))
18
+
12
19
  ### [2.1.76](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers-binary@2.1.76) (2023-11-09)
13
20
 
14
21
  #### ♻️ Refactoring
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/transducers-binary",
3
- "version": "2.1.78",
3
+ "version": "2.1.79",
4
4
  "description": "Binary data related transducers & reducers",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -33,20 +33,21 @@
33
33
  "test": "bun test"
34
34
  },
35
35
  "dependencies": {
36
- "@thi.ng/binary": "^3.3.37",
37
- "@thi.ng/compose": "^2.1.47",
38
- "@thi.ng/errors": "^2.4.2",
39
- "@thi.ng/hex": "^2.3.20",
40
- "@thi.ng/random": "^3.6.14",
41
- "@thi.ng/transducers": "^8.8.11"
36
+ "@thi.ng/binary": "^3.3.38",
37
+ "@thi.ng/compose": "^2.1.48",
38
+ "@thi.ng/errors": "^2.4.3",
39
+ "@thi.ng/hex": "^2.3.21",
40
+ "@thi.ng/random": "^3.6.15",
41
+ "@thi.ng/strings": "^3.7.0",
42
+ "@thi.ng/transducers": "^8.8.12"
42
43
  },
43
44
  "devDependencies": {
44
- "@microsoft/api-extractor": "^7.38.2",
45
- "@thi.ng/testament": "^0.4.1",
45
+ "@microsoft/api-extractor": "^7.38.3",
46
+ "@thi.ng/testament": "^0.4.2",
46
47
  "rimraf": "^5.0.5",
47
48
  "tools": "^0.0.1",
48
49
  "typedoc": "^0.25.3",
49
- "typescript": "^5.2.2"
50
+ "typescript": "^5.3.2"
50
51
  },
51
52
  "keywords": [
52
53
  "array",
@@ -111,5 +112,5 @@
111
112
  ],
112
113
  "year": 2018
113
114
  },
114
- "gitHead": "2be4c38c9680da929339bd164acfb69ebb1fd3d0\n"
115
+ "gitHead": "f6de41f4991704fdbbb2899bb430ed4f4f6efab0\n"
115
116
  }
package/utf8.d.ts CHANGED
@@ -24,5 +24,10 @@ export declare function utf8Decode(src: Iterable<number>): string;
24
24
  */
25
25
  export declare function utf8Encode(): Transducer<string, number>;
26
26
  export declare function utf8Encode(src: string): Uint8Array;
27
+ /**
28
+ * Re-export of [utf8Length()](https://docs.thi.ng/umbrella/strings/functions/utf8Length.html).
29
+ *
30
+ * @deprecated migrated to thi.ng/strings pkg
31
+ */
27
32
  export declare const utf8Length: (str: string) => number;
28
33
  //# sourceMappingURL=utf8.d.ts.map
package/utf8.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { fromUtf8CodePoint, utf8Length as $utf8Length, } from "@thi.ng/strings/utf8";
1
2
  import { compR } from "@thi.ng/transducers/compr";
2
3
  import { iterator, iterator1 } from "@thi.ng/transducers/iterator";
3
4
  import { isReduced } from "@thi.ng/transducers/reduced";
@@ -42,7 +43,7 @@ export function utf8Decode(src) {
42
43
  u3 = x & 0x3f;
43
44
  if ((u0 & 0xf8) === 0xf0) {
44
45
  state = 0;
45
- return r(acc, codePoint(((u0 & 7) << 18) |
46
+ return r(acc, fromUtf8CodePoint(((u0 & 7) << 18) |
46
47
  (u1 << 12) |
47
48
  (u2 << 6) |
48
49
  u3));
@@ -53,7 +54,7 @@ export function utf8Decode(src) {
53
54
  u4 = x & 0x3f;
54
55
  if ((u0 & 0xfc) === 0xf8) {
55
56
  state = 0;
56
- return r(acc, codePoint(((u0 & 3) << 24) |
57
+ return r(acc, fromUtf8CodePoint(((u0 & 3) << 24) |
57
58
  (u1 << 18) |
58
59
  (u2 << 12) |
59
60
  (u3 << 6) |
@@ -63,7 +64,7 @@ export function utf8Decode(src) {
63
64
  break;
64
65
  case 5:
65
66
  state = 0;
66
- return r(acc, codePoint(((u0 & 1) << 30) |
67
+ return r(acc, fromUtf8CodePoint(((u0 & 1) << 30) |
67
68
  (u1 << 24) |
68
69
  (u2 << 18) |
69
70
  (u3 << 12) |
@@ -136,30 +137,9 @@ export function utf8Encode(src) {
136
137
  });
137
138
  };
138
139
  }
139
- const codePoint = (x) => x < 0x10000
140
- ? String.fromCharCode(x)
141
- : ((x -= 0x10000),
142
- String.fromCharCode(0xd800 | (x >> 10), 0xdc00 | (x & 0x3ff)));
143
- export const utf8Length = (str) => {
144
- const n = str.length;
145
- let len = 0;
146
- for (let i = 0; i < n; ++i) {
147
- let u = str.charCodeAt(i);
148
- if (u >= 0xd800 && u <= 0xdfff) {
149
- u = (0x10000 + ((u & 0x3ff) << 10)) | (str.charCodeAt(++i) & 0x3ff);
150
- }
151
- len +=
152
- u <= 0x7f
153
- ? 1
154
- : u <= 0x7ff
155
- ? 2
156
- : u <= 0xffff
157
- ? 3
158
- : u <= 0x1fffff
159
- ? 4
160
- : u <= 0x3ffffff
161
- ? 5
162
- : 6;
163
- }
164
- return len;
165
- };
140
+ /**
141
+ * Re-export of [utf8Length()](https://docs.thi.ng/umbrella/strings/functions/utf8Length.html).
142
+ *
143
+ * @deprecated migrated to thi.ng/strings pkg
144
+ */
145
+ export const utf8Length = $utf8Length;