@nejs/basic-extensions 2.19.0 → 2.20.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/dist/@nejs/{basic-extensions.bundle.2.19.0.js → basic-extensions.bundle.2.20.0.js} +5 -5
- package/dist/@nejs/{basic-extensions.bundle.2.19.0.js.map → basic-extensions.bundle.2.20.0.js.map} +3 -3
- package/dist/cjs/classes/enum.js +11 -8
- package/dist/cjs/classes/enum.js.map +1 -1
- package/dist/cjs/utils/descriptor.utils.js +46 -4
- package/dist/cjs/utils/descriptor.utils.js.map +1 -1
- package/dist/mjs/classes/enum.js +11 -8
- package/dist/mjs/classes/enum.js.map +1 -1
- package/dist/mjs/utils/descriptor.utils.js +46 -4
- package/dist/mjs/utils/descriptor.utils.js.map +1 -1
- package/package.json +2 -2
- package/repl.history +22 -7
- package/src/classes/enum.js +27 -22
- package/src/utils/descriptor.utils.js +55 -5
|
@@ -335,7 +335,32 @@ export const DescriptorUtils = {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
Object.defineProperty(accessor, 'keys', {
|
|
338
|
-
get() { return
|
|
338
|
+
get() { return Object.defineProperties(
|
|
339
|
+
['get', 'set', 'configurable', 'enumerable'],
|
|
340
|
+
{
|
|
341
|
+
from: {
|
|
342
|
+
value: function extractKeysFrom(object) {
|
|
343
|
+
const response = {
|
|
344
|
+
get: undefined,
|
|
345
|
+
set: undefined,
|
|
346
|
+
configurable: undefined,
|
|
347
|
+
enumerable: undefined,
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (!object || !(object instanceof Object))
|
|
351
|
+
return response
|
|
352
|
+
|
|
353
|
+
for (const key of DescriptorUtils.accessor.keys) {
|
|
354
|
+
if (Reflect.has(object, key))
|
|
355
|
+
response[key] = object[key]
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
writable: false,
|
|
359
|
+
configurable: false,
|
|
360
|
+
enumerable: false
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
) },
|
|
339
364
|
configurable: true,
|
|
340
365
|
enumerable: false,
|
|
341
366
|
})
|
|
@@ -468,7 +493,32 @@ export const DescriptorUtils = {
|
|
|
468
493
|
}
|
|
469
494
|
|
|
470
495
|
Object.defineProperty(data, 'keys', {
|
|
471
|
-
value:
|
|
496
|
+
value: Object.defineProperties(
|
|
497
|
+
['value', 'writable', 'configurable', 'enumerable'],
|
|
498
|
+
{
|
|
499
|
+
from: {
|
|
500
|
+
value: function extractKeysFrom(object) {
|
|
501
|
+
const response = {
|
|
502
|
+
value: undefined,
|
|
503
|
+
writable: undefined,
|
|
504
|
+
configurable: undefined,
|
|
505
|
+
enumerable: undefined,
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (!object || !(object instanceof Object))
|
|
509
|
+
return response
|
|
510
|
+
|
|
511
|
+
for (const key of DescriptorUtils.data.keys) {
|
|
512
|
+
if (Reflect.has(object, key))
|
|
513
|
+
response[key] = object[key]
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
writable: false,
|
|
517
|
+
configurable: false,
|
|
518
|
+
enumerable: false,
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
),
|
|
472
522
|
writable: false,
|
|
473
523
|
configurable: true,
|
|
474
524
|
enumerable: false
|
|
@@ -502,9 +552,6 @@ export const DescriptorUtils = {
|
|
|
502
552
|
* stats block.
|
|
503
553
|
*/
|
|
504
554
|
isDescriptor(value, returnStats = false, strict = true) {
|
|
505
|
-
if (!value || typeof value !== 'object' || !(value instanceof Object))
|
|
506
|
-
return false
|
|
507
|
-
|
|
508
555
|
const areBools = (...props) => props.flat().every(
|
|
509
556
|
prop => boolTypes.includes(typeof value[prop])
|
|
510
557
|
);
|
|
@@ -532,6 +579,9 @@ export const DescriptorUtils = {
|
|
|
532
579
|
isValid: false,
|
|
533
580
|
}
|
|
534
581
|
|
|
582
|
+
if (!value || typeof value !== 'object' || !(value instanceof Object))
|
|
583
|
+
return returnStats ? stats : false;
|
|
584
|
+
|
|
535
585
|
let score = 0
|
|
536
586
|
|
|
537
587
|
if (value && typeof value === 'object') {
|