jsfunx 1.2.3 → 1.3.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/LICENSE +1 -1
- package/jsfunx.cjs +28 -22
- package/jsfunx.mjs +28 -22
- package/package.json +1 -1
package/LICENSE
CHANGED
package/jsfunx.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Khiat Mohammed Abderrezzak
|
|
3
|
+
Copyright (c) 2025-2026 Khiat Mohammed Abderrezzak
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -178,22 +178,30 @@ const C = new Proxy(
|
|
|
178
178
|
Object.freeze({
|
|
179
179
|
Arr: Array,
|
|
180
180
|
Array: Array,
|
|
181
|
+
"function Array() { [native code] }": Array,
|
|
181
182
|
BI: BigInt,
|
|
182
183
|
BigInt: BigInt,
|
|
184
|
+
"function BigInt() { [native code] }": BigInt,
|
|
183
185
|
Bool: Boolean,
|
|
184
186
|
Boolean: Boolean,
|
|
187
|
+
"function Boolean() { [native code] }": Boolean,
|
|
185
188
|
Fn: Function,
|
|
186
189
|
Fun: Function,
|
|
187
190
|
Func: Function,
|
|
188
191
|
Function: Function,
|
|
192
|
+
"function Function() { [native code] }": Function,
|
|
189
193
|
Num: Number,
|
|
190
194
|
Number: Number,
|
|
195
|
+
"function Number() { [native code] }": Number,
|
|
191
196
|
Obj: Object,
|
|
192
197
|
Object: Object,
|
|
198
|
+
"function Object() { [native code] }": Object,
|
|
193
199
|
Str: String,
|
|
194
200
|
String: String,
|
|
201
|
+
"function String() { [native code] }": String,
|
|
195
202
|
Sym: Symbol,
|
|
196
203
|
Symbol: Symbol,
|
|
204
|
+
"function Symbol() { [native code] }": Symbol,
|
|
197
205
|
}),
|
|
198
206
|
|
|
199
207
|
{
|
|
@@ -274,6 +282,21 @@ const T = new Proxy(
|
|
|
274
282
|
}
|
|
275
283
|
);
|
|
276
284
|
|
|
285
|
+
/** @type {Set<string | null | undefined>} */
|
|
286
|
+
|
|
287
|
+
const setOfTypes = new Set([
|
|
288
|
+
bi,
|
|
289
|
+
bool,
|
|
290
|
+
fn,
|
|
291
|
+
null,
|
|
292
|
+
num,
|
|
293
|
+
obj,
|
|
294
|
+
str,
|
|
295
|
+
sym,
|
|
296
|
+
undef,
|
|
297
|
+
undefined,
|
|
298
|
+
]);
|
|
299
|
+
|
|
277
300
|
/**
|
|
278
301
|
* Compares a value or a list of values against a given type (or list of types),
|
|
279
302
|
* similar to using `typeof x === y`, but in a more flexible and readable way.
|
|
@@ -290,23 +313,6 @@ const T = new Proxy(
|
|
|
290
313
|
*/
|
|
291
314
|
|
|
292
315
|
function checkType(data, dataType, logic, match, strict) {
|
|
293
|
-
/** @type {Set<string | null | undefined>} */
|
|
294
|
-
|
|
295
|
-
const setOfTypes = new Set([
|
|
296
|
-
and,
|
|
297
|
-
bi,
|
|
298
|
-
bool,
|
|
299
|
-
fn,
|
|
300
|
-
null,
|
|
301
|
-
num,
|
|
302
|
-
obj,
|
|
303
|
-
or,
|
|
304
|
-
str,
|
|
305
|
-
sym,
|
|
306
|
-
undef,
|
|
307
|
-
undefined,
|
|
308
|
-
]);
|
|
309
|
-
|
|
310
316
|
if (!(dataType instanceof Array)) {
|
|
311
317
|
if (!setOfTypes.has(dataType))
|
|
312
318
|
throw new TypeError(`type '${String(dataType)}' undefined !`);
|
|
@@ -753,9 +759,9 @@ function checkType(data, dataType, logic, match, strict) {
|
|
|
753
759
|
}
|
|
754
760
|
|
|
755
761
|
if (data.length !== dataType.length) {
|
|
756
|
-
if (strict)
|
|
762
|
+
if (!$(strict))
|
|
757
763
|
throw new TypeError(
|
|
758
|
-
"length of
|
|
764
|
+
"the length of the dataTypes array must match the number of data items"
|
|
759
765
|
);
|
|
760
766
|
|
|
761
767
|
/** @type {number} */
|
|
@@ -1286,9 +1292,9 @@ function isinstancesof(objs, type, logic, match, strict) {
|
|
|
1286
1292
|
}
|
|
1287
1293
|
|
|
1288
1294
|
if (objs.length !== type.length) {
|
|
1289
|
-
if (strict)
|
|
1295
|
+
if (!$(strict))
|
|
1290
1296
|
throw new TypeError(
|
|
1291
|
-
"length of constructor functions array must match the number of objects"
|
|
1297
|
+
"the length of the constructor functions array must match the number of objects"
|
|
1292
1298
|
);
|
|
1293
1299
|
|
|
1294
1300
|
/** @type {number} */
|
package/jsfunx.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Khiat Mohammed Abderrezzak
|
|
3
|
+
Copyright (c) 2025-2026 Khiat Mohammed Abderrezzak
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -182,22 +182,30 @@ export const C = new Proxy(
|
|
|
182
182
|
Object.freeze({
|
|
183
183
|
Arr: Array,
|
|
184
184
|
Array: Array,
|
|
185
|
+
"function Array() { [native code] }": Array,
|
|
185
186
|
BI: BigInt,
|
|
186
187
|
BigInt: BigInt,
|
|
188
|
+
"function BigInt() { [native code] }": BigInt,
|
|
187
189
|
Bool: Boolean,
|
|
188
190
|
Boolean: Boolean,
|
|
191
|
+
"function Boolean() { [native code] }": Boolean,
|
|
189
192
|
Fn: Function,
|
|
190
193
|
Fun: Function,
|
|
191
194
|
Func: Function,
|
|
192
195
|
Function: Function,
|
|
196
|
+
"function Function() { [native code] }": Function,
|
|
193
197
|
Num: Number,
|
|
194
198
|
Number: Number,
|
|
199
|
+
"function Number() { [native code] }": Number,
|
|
195
200
|
Obj: Object,
|
|
196
201
|
Object: Object,
|
|
202
|
+
"function Object() { [native code] }": Object,
|
|
197
203
|
Str: String,
|
|
198
204
|
String: String,
|
|
205
|
+
"function String() { [native code] }": String,
|
|
199
206
|
Sym: Symbol,
|
|
200
207
|
Symbol: Symbol,
|
|
208
|
+
"function Symbol() { [native code] }": Symbol,
|
|
201
209
|
}),
|
|
202
210
|
|
|
203
211
|
{
|
|
@@ -278,6 +286,21 @@ export const T = new Proxy(
|
|
|
278
286
|
}
|
|
279
287
|
);
|
|
280
288
|
|
|
289
|
+
/** @type {Set<string | null | undefined>} */
|
|
290
|
+
|
|
291
|
+
const setOfTypes = new Set([
|
|
292
|
+
bi,
|
|
293
|
+
bool,
|
|
294
|
+
fn,
|
|
295
|
+
null,
|
|
296
|
+
num,
|
|
297
|
+
obj,
|
|
298
|
+
str,
|
|
299
|
+
sym,
|
|
300
|
+
undef,
|
|
301
|
+
undefined,
|
|
302
|
+
]);
|
|
303
|
+
|
|
281
304
|
/**
|
|
282
305
|
* Compares a value or a list of values against a given type (or list of types),
|
|
283
306
|
* similar to using `typeof x === y`, but in a more flexible and readable way.
|
|
@@ -294,23 +317,6 @@ export const T = new Proxy(
|
|
|
294
317
|
*/
|
|
295
318
|
|
|
296
319
|
function checkType(data, dataType, logic, match, strict) {
|
|
297
|
-
/** @type {Set<string | null | undefined>} */
|
|
298
|
-
|
|
299
|
-
const setOfTypes = new Set([
|
|
300
|
-
and,
|
|
301
|
-
bi,
|
|
302
|
-
bool,
|
|
303
|
-
fn,
|
|
304
|
-
null,
|
|
305
|
-
num,
|
|
306
|
-
obj,
|
|
307
|
-
or,
|
|
308
|
-
str,
|
|
309
|
-
sym,
|
|
310
|
-
undef,
|
|
311
|
-
undefined,
|
|
312
|
-
]);
|
|
313
|
-
|
|
314
320
|
if (!(dataType instanceof Array)) {
|
|
315
321
|
if (!setOfTypes.has(dataType))
|
|
316
322
|
throw new TypeError(`type '${String(dataType)}' undefined !`);
|
|
@@ -757,9 +763,9 @@ function checkType(data, dataType, logic, match, strict) {
|
|
|
757
763
|
}
|
|
758
764
|
|
|
759
765
|
if (data.length !== dataType.length) {
|
|
760
|
-
if (strict)
|
|
766
|
+
if (!$(strict))
|
|
761
767
|
throw new TypeError(
|
|
762
|
-
"length of
|
|
768
|
+
"the length of the dataTypes array must match the number of data items"
|
|
763
769
|
);
|
|
764
770
|
|
|
765
771
|
/** @type {number} */
|
|
@@ -1290,9 +1296,9 @@ function isinstancesof(objs, type, logic, match, strict) {
|
|
|
1290
1296
|
}
|
|
1291
1297
|
|
|
1292
1298
|
if (objs.length !== type.length) {
|
|
1293
|
-
if (strict)
|
|
1299
|
+
if (!$(strict))
|
|
1294
1300
|
throw new TypeError(
|
|
1295
|
-
"length of constructor functions array must match the number of objects"
|
|
1301
|
+
"the length of the constructor functions array must match the number of objects"
|
|
1296
1302
|
);
|
|
1297
1303
|
|
|
1298
1304
|
/** @type {number} */
|