@thi.ng/csp 2.1.115 → 3.0.0
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 +35 -1
- package/README.md +50 -183
- package/api.d.ts +12 -20
- package/channel.d.ts +37 -145
- package/channel.js +131 -480
- package/idgen.d.ts +3 -0
- package/idgen.js +5 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/mult.d.ts +12 -20
- package/mult.js +42 -80
- package/ops.d.ts +23 -0
- package/ops.js +117 -0
- package/package.json +19 -17
- package/pubsub.d.ts +14 -20
- package/pubsub.js +32 -49
- package/buffer.d.ts +0 -24
- package/buffer.js +0 -67
package/buffer.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { DCons } from "@thi.ng/dcons/dcons";
|
|
2
|
-
class FixedBuffer {
|
|
3
|
-
buf;
|
|
4
|
-
limit;
|
|
5
|
-
constructor(limit = 1) {
|
|
6
|
-
this.buf = new DCons();
|
|
7
|
-
this.limit = limit;
|
|
8
|
-
}
|
|
9
|
-
get length() {
|
|
10
|
-
return this.buf.length;
|
|
11
|
-
}
|
|
12
|
-
isEmpty() {
|
|
13
|
-
return this.buf.length === 0;
|
|
14
|
-
}
|
|
15
|
-
isFull() {
|
|
16
|
-
return this.buf.length >= this.limit;
|
|
17
|
-
}
|
|
18
|
-
release() {
|
|
19
|
-
return this.buf.release();
|
|
20
|
-
}
|
|
21
|
-
push(x) {
|
|
22
|
-
if (!this.isFull()) {
|
|
23
|
-
this.buf.push(x);
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
drop() {
|
|
29
|
-
if (!this.isEmpty()) {
|
|
30
|
-
return this.buf.drop();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
class DroppingBuffer extends FixedBuffer {
|
|
35
|
-
constructor(limit = 1) {
|
|
36
|
-
super(limit);
|
|
37
|
-
}
|
|
38
|
-
isFull() {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
push(x) {
|
|
42
|
-
if (this.buf.length < this.limit) {
|
|
43
|
-
this.buf.push(x);
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
class SlidingBuffer extends FixedBuffer {
|
|
49
|
-
constructor(limit = 1) {
|
|
50
|
-
super(limit);
|
|
51
|
-
}
|
|
52
|
-
isFull() {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
push(x) {
|
|
56
|
-
if (this.buf.length >= this.limit) {
|
|
57
|
-
this.buf.drop();
|
|
58
|
-
}
|
|
59
|
-
this.buf.push(x);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
DroppingBuffer,
|
|
65
|
-
FixedBuffer,
|
|
66
|
-
SlidingBuffer
|
|
67
|
-
};
|