@thi.ng/csp 2.1.80 → 2.1.82

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-12-03T12:13:31Z
3
+ - **Last updated**: 2023-12-11T10:07:09Z
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
@@ -78,7 +78,7 @@ For Node.js REPL:
78
78
  const csp = await import("@thi.ng/csp");
79
79
  ```
80
80
 
81
- Package sizes (brotli'd, pre-treeshake): ESM: 2.65 KB
81
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.58 KB
82
82
 
83
83
  ## Dependencies
84
84
 
package/api.js CHANGED
@@ -1 +0,0 @@
1
- export {};
package/buffer.js CHANGED
@@ -1,62 +1,67 @@
1
1
  import { DCons } from "@thi.ng/dcons/dcons";
2
- export class FixedBuffer {
3
- buf;
4
- limit;
5
- constructor(limit = 1) {
6
- this.buf = new DCons();
7
- this.limit = limit;
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;
8
25
  }
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
- }
26
+ return false;
27
+ }
28
+ drop() {
29
+ if (!this.isEmpty()) {
30
+ return this.buf.drop();
32
31
  }
32
+ }
33
33
  }
34
- export 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;
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);
46
44
  }
45
+ return true;
46
+ }
47
47
  }
48
- export 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;
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();
61
58
  }
59
+ this.buf.push(x);
60
+ return true;
61
+ }
62
62
  }
63
+ export {
64
+ DroppingBuffer,
65
+ FixedBuffer,
66
+ SlidingBuffer
67
+ };