foxts 1.0.12 → 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/package.json +19 -10
- package/repool/index.cjs +1 -0
- package/repool/index.d.ts +18 -0
- package/repool/index.mjs +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "1.0.
|
|
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": {
|
|
@@ -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": {
|
package/repool/index.cjs
ADDED
|
@@ -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 };
|
package/repool/index.mjs
ADDED
|
@@ -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};
|