@thi.ng/csp 3.2.12 → 3.2.13

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-10-05T12:12:32Z
3
+ - **Last updated**: 2024-10-17T15:38:52Z
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
+ ### [3.2.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/csp@3.2.13) (2024-10-17)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - undeprecate `into()`, refactor `pipe()` ([c8788d9](https://github.com/thi-ng/umbrella/commit/c8788d9))
17
+ - update docstrings
18
+
12
19
  ### [3.2.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/csp@3.2.2) (2024-06-21)
13
20
 
14
21
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -158,7 +158,7 @@ For Node.js REPL:
158
158
  const csp = await import("@thi.ng/csp");
159
159
  ```
160
160
 
161
- Package sizes (brotli'd, pre-treeshake): ESM: 1.80 KB
161
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.78 KB
162
162
 
163
163
  ## Dependencies
164
164
 
package/ops.d.ts CHANGED
@@ -42,15 +42,23 @@ export declare const drain: <T>(chan: Channel<T>) => Promise<Awaited<T>[]>;
42
42
  */
43
43
  export declare const fromAsyncIterable: <T>(src: AsyncIterable<T>, close?: boolean) => Channel<T>;
44
44
  export declare const merge: <T>(src: Channel<T>[], dest?: Channel<T>, close?: boolean) => Channel<T>;
45
- /**
46
- * @deprecated use {@link pipe} instead.
47
- */
48
- export declare const into: <T, DEST extends IWriteable<T> & IClosable>(chan: DEST, src: Iterable<T> | AsyncIterable<T>, close?: boolean) => Promise<void>;
49
45
  /**
50
46
  * Receives values from `src` and writes them to `dest` for as long as it's
51
47
  * accepting new writes (i.e. isn't closed from elsewhere). If `close` is true
52
48
  * (default), the `dest` channel will be automatically closed once the `src` is
53
- * exhausted. Returns `dest` channel.
49
+ * exhausted. Returns a void-promise which resolves once done.
50
+ *
51
+ * @param dest
52
+ * @param src
53
+ * @param close
54
+ */
55
+ export declare const into: <T, DEST extends IWriteable<T> & IClosable>(dest: DEST, src: Iterable<T> | AsyncIterable<T>, close?: boolean) => Promise<void>;
56
+ /**
57
+ * Similar to {@link into} (and also calls that function asynchronously), but
58
+ * `pipe()` itself is synchronous and returns `dest` channel immediatedly.
59
+ *
60
+ * @remarks
61
+ * Also note different argument order!
54
62
  *
55
63
  * @param src
56
64
  * @param dest
package/ops.js CHANGED
@@ -58,21 +58,15 @@ const merge = (src, dest, close = true) => {
58
58
  })();
59
59
  return dest;
60
60
  };
61
- const into = async (chan, src, close = false) => {
61
+ const into = async (dest, src, close = false) => {
62
62
  for await (let x of src) {
63
- if (!chan.writable()) break;
64
- await chan.write(x);
63
+ if (!dest.writable()) break;
64
+ await dest.write(x);
65
65
  }
66
- close && chan.close();
66
+ close && dest.close();
67
67
  };
68
68
  const pipe = (src, dest, close = true) => {
69
- (async () => {
70
- for await (let x of src) {
71
- await dest.write(x);
72
- if (!dest.writable()) break;
73
- }
74
- close && dest.close();
75
- })();
69
+ into(dest, src, close);
76
70
  return dest;
77
71
  };
78
72
  const select = async (input, ...rest) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/csp",
3
- "version": "3.2.12",
3
+ "version": "3.2.13",
4
4
  "description": "Primitives & operators for Communicating Sequential Processes based on async/await and async iterables",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -106,5 +106,5 @@
106
106
  "status": "beta",
107
107
  "year": 2016
108
108
  },
109
- "gitHead": "11ae480076e61a2263f5730ffb37dfddbf01c7d1\n"
109
+ "gitHead": "8301254c4436505a1fb0e3cc28eca3adb920c3e0\n"
110
110
  }