foxts 1.0.11 → 1.0.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/noop/index.d.ts CHANGED
@@ -6,4 +6,4 @@ declare const trueFn: Noop<true>;
6
6
  declare const falseFn: Noop<false>;
7
7
  declare const throwFn: Noop<never>;
8
8
 
9
- export { falseFn, noop, throwFn, trueFn };
9
+ export { type Noop, falseFn, noop, throwFn, trueFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -47,6 +47,15 @@
47
47
  "require": "./ahocorasick/index.cjs",
48
48
  "default": "./ahocorasick/index.cjs"
49
49
  },
50
+ "./append-set-elements-to-array": {
51
+ "types": "./append-set-elements-to-array/index.d.ts",
52
+ "import": {
53
+ "types": "./append-set-elements-to-array/index.d.ts",
54
+ "default": "./append-set-elements-to-array/index.mjs"
55
+ },
56
+ "require": "./append-set-elements-to-array/index.cjs",
57
+ "default": "./append-set-elements-to-array/index.cjs"
58
+ },
50
59
  "./async-write-to-stream": {
51
60
  "types": "./async-write-to-stream/index.d.ts",
52
61
  "import": {
@@ -65,15 +74,6 @@
65
74
  "require": "./bitwise/index.cjs",
66
75
  "default": "./bitwise/index.cjs"
67
76
  },
68
- "./append-set-elements-to-array": {
69
- "types": "./append-set-elements-to-array/index.d.ts",
70
- "import": {
71
- "types": "./append-set-elements-to-array/index.d.ts",
72
- "default": "./append-set-elements-to-array/index.mjs"
73
- },
74
- "require": "./append-set-elements-to-array/index.cjs",
75
- "default": "./append-set-elements-to-array/index.cjs"
76
- },
77
77
  "./escape-string-regexp": {
78
78
  "types": "./escape-string-regexp/index.d.ts",
79
79
  "import": {
@@ -119,6 +119,15 @@
119
119
  "require": "./fnv1a52/index.cjs",
120
120
  "default": "./fnv1a52/index.cjs"
121
121
  },
122
+ "./guard": {
123
+ "types": "./guard/index.d.ts",
124
+ "import": {
125
+ "types": "./guard/index.d.ts",
126
+ "default": "./guard/index.mjs"
127
+ },
128
+ "require": "./guard/index.cjs",
129
+ "default": "./guard/index.cjs"
130
+ },
122
131
  "./headers-to-object": {
123
132
  "types": "./headers-to-object/index.d.ts",
124
133
  "import": {
@@ -128,14 +137,14 @@
128
137
  "require": "./headers-to-object/index.cjs",
129
138
  "default": "./headers-to-object/index.cjs"
130
139
  },
131
- "./guard": {
132
- "types": "./guard/index.d.ts",
140
+ "./identity": {
141
+ "types": "./identity/index.d.ts",
133
142
  "import": {
134
- "types": "./guard/index.d.ts",
135
- "default": "./guard/index.mjs"
143
+ "types": "./identity/index.d.ts",
144
+ "default": "./identity/index.mjs"
136
145
  },
137
- "require": "./guard/index.cjs",
138
- "default": "./guard/index.cjs"
146
+ "require": "./identity/index.cjs",
147
+ "default": "./identity/index.cjs"
139
148
  },
140
149
  "./is-probably-ip": {
141
150
  "types": "./is-probably-ip/index.d.ts",
@@ -155,15 +164,6 @@
155
164
  "require": "./merge-headers/index.cjs",
156
165
  "default": "./merge-headers/index.cjs"
157
166
  },
158
- "./identity": {
159
- "types": "./identity/index.d.ts",
160
- "import": {
161
- "types": "./identity/index.d.ts",
162
- "default": "./identity/index.mjs"
163
- },
164
- "require": "./identity/index.cjs",
165
- "default": "./identity/index.cjs"
166
- },
167
167
  "./noop": {
168
168
  "types": "./noop/index.d.ts",
169
169
  "import": {
@@ -173,6 +173,15 @@
173
173
  "require": "./noop/index.cjs",
174
174
  "default": "./noop/index.cjs"
175
175
  },
176
+ "./repool": {
177
+ "types": "./repool/index.d.ts",
178
+ "import": {
179
+ "types": "./repool/index.d.ts",
180
+ "default": "./repool/index.mjs"
181
+ },
182
+ "require": "./repool/index.cjs",
183
+ "default": "./repool/index.cjs"
184
+ },
176
185
  "./serialized-memo": {
177
186
  "types": "./serialized-memo/index.d.ts",
178
187
  "import": {
@@ -0,0 +1 @@
1
+ "use strict";exports.Repool=class{createObject;head;tail;constructor(t){this.createObject=t;const e=t();this.tail=e,this.head=e}get(){const t=this.head;if(t.next)this.head=t.next;else{const t=this.createObject();this.tail=t,this.head=t}return t.next=null,t}release(t){this.tail.next=t,this.tail=t}};
@@ -0,0 +1,18 @@
1
+ interface Reusifiable {
2
+ next: this | null;
3
+ }
4
+ /**
5
+ * Repool is a class that allows you to reuse objects.
6
+ *
7
+ * Do not use this to store class instances, please use https://github.com/mcollina/reusify instead.
8
+ */
9
+ declare class Repool<T extends Reusifiable> {
10
+ private createObject;
11
+ private head;
12
+ private tail;
13
+ constructor(createObject: () => T);
14
+ get(): T;
15
+ release(obj: T): void;
16
+ }
17
+
18
+ export { Repool, type Reusifiable };
@@ -0,0 +1 @@
1
+ class t{createObject;head;tail;constructor(t){this.createObject=t;const e=t();this.tail=e,this.head=e}get(){const t=this.head;if(t.next)this.head=t.next;else{const t=this.createObject();this.tail=t,this.head=t}return t.next=null,t}release(t){this.tail.next=t,this.tail=t}}export{t as Repool};