@thi.ng/csp 2.1.30 → 2.1.31

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**: 2022-11-30T22:27:37Z
3
+ - **Last updated**: 2022-12-16T12:52:25Z
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.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
 
3
- # ![csp](https://media.thi.ng/umbrella/banners-20220914/thing-csp.svg?dd2a4b97)
3
+ # ![@thi.ng/csp](https://media.thi.ng/umbrella/banners-20220914/thing-csp.svg?dd2a4b97)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/csp.svg)](https://www.npmjs.com/package/@thi.ng/csp)
6
6
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/csp.svg)
7
- [![Twitter Follow](https://img.shields.io/twitter/follow/thing_umbrella.svg?style=flat-square&label=twitter)](https://twitter.com/thing_umbrella)
7
+ [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](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.
@@ -23,7 +23,7 @@ This project is part of the
23
23
 
24
24
  ## About
25
25
 
26
- ES6 promise based CSP primitives & operations.
26
+ ES6 promise based CSP primitives & operations
27
27
 
28
28
  - `Channel` with/without buffering and/or
29
29
  [transducers](https://github.com/thi-ng/umbrella/blob/develop/packages/transducers)
@@ -43,7 +43,7 @@ ES6 promise based CSP primitives & operations.
43
43
 
44
44
  ## Status
45
45
 
46
- **DEPRECATED** - no further development planned
46
+ **DEPRECATED** - superseded by other package(s)
47
47
 
48
48
  [Search or submit any issues for this package](https://github.com/thi-ng/umbrella/issues?q=%5Bcsp%5D+in%3Atitle)
49
49
 
@@ -71,14 +71,11 @@ ES module import:
71
71
 
72
72
  For Node.js REPL:
73
73
 
74
- ```text
75
- # with flag only for < v16
76
- node --experimental-repl-await
77
-
78
- > const csp = await import("@thi.ng/csp");
74
+ ```js
75
+ const csp = await import("@thi.ng/csp");
79
76
  ```
80
77
 
81
- Package sizes (brotli'd, pre-treeshake): ESM: 2.41 KB
78
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.42 KB
82
79
 
83
80
  ## Dependencies
84
81
 
@@ -253,7 +250,7 @@ pub.channel().into(["alice", "bert", "bella", "charlie", "arthur"]);
253
250
 
254
251
  ## Authors
255
252
 
256
- Karsten Schmidt
253
+ - [Karsten Schmidt](https://thi.ng)
257
254
 
258
255
  If this project contributes to an academic publication, please cite it as:
259
256
 
@@ -268,4 +265,4 @@ If this project contributes to an academic publication, please cite it as:
268
265
 
269
266
  ## License
270
267
 
271
- &copy; 2016 - 2022 Karsten Schmidt // Apache Software License 2.0
268
+ &copy; 2016 - 2022 Karsten Schmidt // Apache License 2.0
package/api.d.ts CHANGED
@@ -22,6 +22,6 @@ export interface IWriteableChannel<T> extends IChannel<T> {
22
22
  }
23
23
  export interface IReadWriteableChannel<T> extends IReadableChannel<T>, IWriteableChannel<T> {
24
24
  }
25
- export declare type TopicFn<T> = Fn<T, string>;
26
- export declare type ErrorHandler = (e: Error, chan: Channel<any>, val?: any) => void;
25
+ export type TopicFn<T> = Fn<T, string>;
26
+ export type ErrorHandler = (e: Error, chan: Channel<any>, val?: any) => void;
27
27
  //# sourceMappingURL=api.d.ts.map
package/channel.js CHANGED
@@ -8,62 +8,6 @@ import { range } from "@thi.ng/transducers/range";
8
8
  import { isReduced, unreduced } from "@thi.ng/transducers/reduced";
9
9
  import { FixedBuffer } from "./buffer.js";
10
10
  export class Channel {
11
- constructor(...args) {
12
- let id, buf, tx, err;
13
- let [a, b] = args;
14
- switch (args.length) {
15
- case 0:
16
- break;
17
- case 1:
18
- if (typeof a === "string") {
19
- id = a;
20
- }
21
- else if (maybeBuffer(a)) {
22
- buf = a;
23
- }
24
- else {
25
- tx = a;
26
- }
27
- break;
28
- case 2:
29
- if (typeof a === "string") {
30
- id = a;
31
- if (maybeBuffer(b)) {
32
- buf = b;
33
- }
34
- else {
35
- tx = b;
36
- }
37
- }
38
- else {
39
- [tx, err] = args;
40
- }
41
- break;
42
- case 3:
43
- if (isFunction(args[1]) && isFunction(args[2])) {
44
- [id, tx, err] = args;
45
- }
46
- else {
47
- [id, buf, tx] = args;
48
- }
49
- break;
50
- case 4:
51
- [id, buf, tx, err] = args;
52
- break;
53
- default:
54
- illegalArity(args.length);
55
- }
56
- this.id = id || `chan-${Channel.NEXT_ID++}`;
57
- buf = buf || 1;
58
- this.buf = typeof buf === "number" ? new FixedBuffer(buf) : buf;
59
- this.writes = new DCons();
60
- this.reads = new DCons();
61
- this.txbuf = new DCons();
62
- this.tx = tx ? tx(Channel.RFN) : null;
63
- this.onerror = tx && (err || defaultErrorHandler);
64
- this.state = 0 /* State.OPEN */;
65
- this.isBusy = false;
66
- }
67
11
  static constantly(x, delay) {
68
12
  const chan = new Channel(delay ? delayed(delay) : null);
69
13
  chan.produce(() => x);
@@ -263,6 +207,62 @@ export class Channel {
263
207
  })();
264
208
  return out;
265
209
  }
210
+ constructor(...args) {
211
+ let id, buf, tx, err;
212
+ let [a, b] = args;
213
+ switch (args.length) {
214
+ case 0:
215
+ break;
216
+ case 1:
217
+ if (typeof a === "string") {
218
+ id = a;
219
+ }
220
+ else if (maybeBuffer(a)) {
221
+ buf = a;
222
+ }
223
+ else {
224
+ tx = a;
225
+ }
226
+ break;
227
+ case 2:
228
+ if (typeof a === "string") {
229
+ id = a;
230
+ if (maybeBuffer(b)) {
231
+ buf = b;
232
+ }
233
+ else {
234
+ tx = b;
235
+ }
236
+ }
237
+ else {
238
+ [tx, err] = args;
239
+ }
240
+ break;
241
+ case 3:
242
+ if (isFunction(args[1]) && isFunction(args[2])) {
243
+ [id, tx, err] = args;
244
+ }
245
+ else {
246
+ [id, buf, tx] = args;
247
+ }
248
+ break;
249
+ case 4:
250
+ [id, buf, tx, err] = args;
251
+ break;
252
+ default:
253
+ illegalArity(args.length);
254
+ }
255
+ this.id = id || `chan-${Channel.NEXT_ID++}`;
256
+ buf = buf || 1;
257
+ this.buf = typeof buf === "number" ? new FixedBuffer(buf) : buf;
258
+ this.writes = new DCons();
259
+ this.reads = new DCons();
260
+ this.txbuf = new DCons();
261
+ this.tx = tx ? tx(Channel.RFN) : null;
262
+ this.onerror = tx && (err || defaultErrorHandler);
263
+ this.state = 0 /* State.OPEN */;
264
+ this.isBusy = false;
265
+ }
266
266
  channel() {
267
267
  return this;
268
268
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/csp",
3
- "version": "2.1.30",
3
+ "version": "2.1.31",
4
4
  "description": "ES6 promise based CSP primitives & operations",
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 <k+npm@thi.ng>",
24
+ "author": "Karsten Schmidt (https://thi.ng)",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
27
  "build": "yarn clean && tsc --declaration",
@@ -38,20 +38,20 @@
38
38
  "testnode": "tsc -p test && node build/test/node.js"
39
39
  },
40
40
  "dependencies": {
41
- "@thi.ng/api": "^8.5.1",
42
- "@thi.ng/arrays": "^2.4.4",
43
- "@thi.ng/checks": "^3.3.4",
44
- "@thi.ng/dcons": "^3.2.25",
45
- "@thi.ng/errors": "^2.2.5",
46
- "@thi.ng/transducers": "^8.3.25"
41
+ "@thi.ng/api": "^8.6.0",
42
+ "@thi.ng/arrays": "^2.4.5",
43
+ "@thi.ng/checks": "^3.3.5",
44
+ "@thi.ng/dcons": "^3.2.26",
45
+ "@thi.ng/errors": "^2.2.6",
46
+ "@thi.ng/transducers": "^8.3.26"
47
47
  },
48
48
  "devDependencies": {
49
- "@microsoft/api-extractor": "^7.33.5",
50
- "@thi.ng/testament": "^0.3.6",
49
+ "@microsoft/api-extractor": "^7.33.7",
50
+ "@thi.ng/testament": "^0.3.7",
51
51
  "rimraf": "^3.0.2",
52
52
  "tools": "^0.0.1",
53
- "typedoc": "^0.23.20",
54
- "typescript": "^4.8.4"
53
+ "typedoc": "^0.23.22",
54
+ "typescript": "^4.9.4"
55
55
  },
56
56
  "keywords": [
57
57
  "async",
@@ -102,5 +102,5 @@
102
102
  "status": "deprecated",
103
103
  "year": 2016
104
104
  },
105
- "gitHead": "1fe40da507070653f420156d91e6b27cf682004f\n"
105
+ "gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
106
106
  }