@gershy/clearing 0.0.8 → 0.0.10
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/cmp/cjs/main.js +1 -1
- package/cmp/mjs/main.js +1 -1
- package/cmp/types/global.d.ts +65 -9
- package/package.json +11 -13
package/cmp/cjs/main.js
CHANGED
package/cmp/mjs/main.js
CHANGED
package/cmp/types/global.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare global {
|
|
|
63
63
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
// <SYMBOLS>
|
|
66
|
+
// <SYMBOLS> :: declarations :: /const ([a-zA-Z0-9]+)[ ]*[:][ ]*unique symbol;/
|
|
67
67
|
const add: unique symbol;
|
|
68
68
|
const allArr: unique symbol;
|
|
69
69
|
const allObj: unique symbol;
|
|
@@ -114,10 +114,66 @@ declare global {
|
|
|
114
114
|
const upper: unique symbol;
|
|
115
115
|
// </SYMBOLS>
|
|
116
116
|
|
|
117
|
+
// Adding symbol properties to Object.prototype will cause typescript to think these properties
|
|
118
|
+
// are also available for extending types, e.g. Array - to avoid this we merge in an object which
|
|
119
|
+
// defines every symbol as `undefined`!
|
|
120
|
+
type SymbolsProto = {
|
|
121
|
+
// <SYMBOLS> :: SymbolsProto :: /\[([a-zA-Z0-9]+)\][ ]*[:][ ]*undefined
|
|
122
|
+
[add]: undefined,
|
|
123
|
+
[allArr]: undefined,
|
|
124
|
+
[allObj]: undefined,
|
|
125
|
+
[at]: undefined,
|
|
126
|
+
[assert]: undefined,
|
|
127
|
+
[base32]: undefined,
|
|
128
|
+
[base36]: undefined,
|
|
129
|
+
[base62]: undefined,
|
|
130
|
+
[base64Std]: undefined,
|
|
131
|
+
[base64Url]: undefined,
|
|
132
|
+
[baseline]: undefined,
|
|
133
|
+
[bind]: undefined,
|
|
134
|
+
[bits]: undefined,
|
|
135
|
+
[char]: undefined,
|
|
136
|
+
[charset]: undefined,
|
|
137
|
+
[code]: undefined,
|
|
138
|
+
[count]: undefined,
|
|
139
|
+
[cut]: undefined,
|
|
140
|
+
[dive]: undefined,
|
|
141
|
+
[empty]: undefined,
|
|
142
|
+
[find]: undefined,
|
|
143
|
+
[fire]: undefined,
|
|
144
|
+
[group]: undefined,
|
|
145
|
+
[has]: undefined,
|
|
146
|
+
[hasHead]: undefined,
|
|
147
|
+
[hasTail]: undefined,
|
|
148
|
+
[indent]: undefined,
|
|
149
|
+
[int32]: undefined,
|
|
150
|
+
[int64]: undefined,
|
|
151
|
+
[isInt]: undefined,
|
|
152
|
+
[later]: undefined,
|
|
153
|
+
[limn]: undefined,
|
|
154
|
+
[lower]: undefined,
|
|
155
|
+
[map]: undefined,
|
|
156
|
+
[mapk]: undefined,
|
|
157
|
+
[merge]: undefined,
|
|
158
|
+
[mod]: undefined,
|
|
159
|
+
[padHead]: undefined,
|
|
160
|
+
[padTail]: undefined,
|
|
161
|
+
[rem]: undefined,
|
|
162
|
+
[slash]: undefined,
|
|
163
|
+
[slice]: undefined,
|
|
164
|
+
[suppress]: undefined,
|
|
165
|
+
[toArr]: undefined,
|
|
166
|
+
[toNum]: undefined,
|
|
167
|
+
[toObj]: undefined,
|
|
168
|
+
[toStr]: undefined,
|
|
169
|
+
[upper]: undefined
|
|
170
|
+
// </SYMBOLS>
|
|
171
|
+
};
|
|
172
|
+
|
|
117
173
|
interface ErrorConstructor {
|
|
118
174
|
[assert]: <V = any>(args: V, fn: (args: V) => boolean) => void
|
|
119
175
|
}
|
|
120
|
-
interface Error {
|
|
176
|
+
interface Error extends SymbolsProto {
|
|
121
177
|
[mod]: (props: { [K: string]: any }) => Error,
|
|
122
178
|
[fire]: (props?: { [K: string]: any }) => never,
|
|
123
179
|
[suppress]: () => Error,
|
|
@@ -130,7 +186,7 @@ declare global {
|
|
|
130
186
|
}
|
|
131
187
|
|
|
132
188
|
interface ArrayConstructor {}
|
|
133
|
-
interface Array<T> {
|
|
189
|
+
interface Array<T> extends SymbolsProto {
|
|
134
190
|
[has]: (val: unknown) => boolean,
|
|
135
191
|
[map]: <Fn extends (v: T, i: number) => any>(fn: Fn) => Exclude<ReturnType<Fn>, Skip>[],
|
|
136
192
|
[add]: <TT extends T>(val: TT) => TT,
|
|
@@ -143,7 +199,7 @@ declare global {
|
|
|
143
199
|
}
|
|
144
200
|
|
|
145
201
|
interface FunctionConstructor {}
|
|
146
|
-
interface Function {
|
|
202
|
+
interface Function extends SymbolsProto {
|
|
147
203
|
[bind]: <Fn extends (...args: any[]) => any, To>(this: Fn, to: To) => ((...args: Parameters<Fn> extends [ infer A0, ...infer AM ] ? AM : never) => ReturnType<Fn>)
|
|
148
204
|
}
|
|
149
205
|
|
|
@@ -151,7 +207,7 @@ declare global {
|
|
|
151
207
|
[int32]: number,
|
|
152
208
|
[int64]: number
|
|
153
209
|
}
|
|
154
|
-
interface Number {
|
|
210
|
+
interface Number extends SymbolsProto {
|
|
155
211
|
[char]: () => string,
|
|
156
212
|
[isInt]: () => boolean,
|
|
157
213
|
[toStr]: (str: string | CharSet, len?: number) => string,
|
|
@@ -162,7 +218,7 @@ declare global {
|
|
|
162
218
|
}
|
|
163
219
|
|
|
164
220
|
interface BigIntConstructor {}
|
|
165
|
-
interface BigInt {
|
|
221
|
+
interface BigInt extends SymbolsProto {
|
|
166
222
|
[toStr]: (str: string | CharSet, len?: number) => string
|
|
167
223
|
}
|
|
168
224
|
|
|
@@ -194,7 +250,7 @@ declare global {
|
|
|
194
250
|
}
|
|
195
251
|
|
|
196
252
|
interface SetConstructor {}
|
|
197
|
-
interface Set<T> {
|
|
253
|
+
interface Set<T> extends SymbolsProto {
|
|
198
254
|
[count]: () => number,
|
|
199
255
|
[empty]: () => boolean,
|
|
200
256
|
[find]: (fn: (val: T) => any) => ({ found: true, val: T } | { found: false, val: null }),
|
|
@@ -205,7 +261,7 @@ declare global {
|
|
|
205
261
|
}
|
|
206
262
|
|
|
207
263
|
interface MapConstructor {}
|
|
208
|
-
interface Map<K, V> {
|
|
264
|
+
interface Map<K, V> extends SymbolsProto {
|
|
209
265
|
[add]: (k: K, v: V) => void,
|
|
210
266
|
[count]: () => number,
|
|
211
267
|
[empty]: () => boolean,
|
|
@@ -225,7 +281,7 @@ declare global {
|
|
|
225
281
|
[baseline]: (str: string) => string,
|
|
226
282
|
[charset]: (str: string) => CharSet,
|
|
227
283
|
}
|
|
228
|
-
interface String {
|
|
284
|
+
interface String extends SymbolsProto {
|
|
229
285
|
[code]: (ind?: number) => number,
|
|
230
286
|
[count]: () => number,
|
|
231
287
|
[has]: (s: string) => boolean,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gershy/clearing",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Adds the features you always wish javascript had!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"clearing",
|
|
@@ -17,31 +17,29 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/gershy/clearing#readme",
|
|
19
19
|
"license": "ISC",
|
|
20
|
-
"types": "./cmp/types/global.d.ts",
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"import": "./cmp/mjs/main.js",
|
|
24
|
-
"require": "./cmp/cjs/main.js",
|
|
25
|
-
"types": "./cmp/types/global.d.ts"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
20
|
"devDependencies": {
|
|
29
21
|
"@types/node": "^24.10.1",
|
|
30
|
-
"cpx": "^1.5.0",
|
|
31
|
-
"rimraf": "^6.1.2",
|
|
32
22
|
"tsx": "^4.21.0",
|
|
33
23
|
"typescript": "^5.9.3"
|
|
34
24
|
},
|
|
35
25
|
"files": [
|
|
36
26
|
"cmp"
|
|
37
27
|
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": "./cmp/mjs/main.js",
|
|
31
|
+
"require": "./cmp/cjs/main.js",
|
|
32
|
+
"types": "./cmp/types/global.d.ts"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"types": "./cmp/types/global.d.ts",
|
|
38
36
|
"scripts": {
|
|
39
37
|
"test": "npx tsx ./src/main.test.mts",
|
|
40
38
|
"ts.check": "npx tsc --noEmit",
|
|
41
39
|
"build.cjs": "tsc -p ts/tsconfig.cjs.json",
|
|
42
40
|
"build.mjs": "tsc -p ts/tsconfig.mjs.json",
|
|
43
|
-
"build.types": "
|
|
44
|
-
"build": "
|
|
41
|
+
"build.types": "node build.js copyGlobalTypes",
|
|
42
|
+
"build": "node build.js removeCmp && npm run build.cjs && npm run build.mjs && npm run build.types",
|
|
45
43
|
"git.pub": "npm run test && git add --all && git commit -m \"automated\" && git push",
|
|
46
44
|
"npm.login": "npm login",
|
|
47
45
|
"npm.pub": "npm run test && npm run build && npm publish --access public"
|