tods-competition-factory 1.8.46 → 1.9.1
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/forge/generate.mjs +155 -81
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +5 -2
- package/dist/forge/query.mjs +327 -163
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +97 -61
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +7 -4
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +630 -340
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +842 -475
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +6 -6
package/dist/forge/utilities.mjs
CHANGED
|
@@ -469,7 +469,7 @@ function getAccessorValue({ element, accessor }) {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
function isObject(obj) {
|
|
472
|
-
return typeof obj === "object";
|
|
472
|
+
return obj !== null && typeof obj === "object";
|
|
473
473
|
}
|
|
474
474
|
function createMap(objectArray, attribute) {
|
|
475
475
|
if (!Array.isArray(objectArray))
|
|
@@ -489,6 +489,11 @@ const extractAttributes = (accessor) => (element) => !accessor || typeof element
|
|
|
489
489
|
})) || typeof accessor === "object" && Object.keys(accessor).map((key) => ({
|
|
490
490
|
[key]: getAccessorValue({ element, accessor: key })?.value
|
|
491
491
|
})) || (typeof accessor === "string" && getAccessorValue({ element, accessor }))?.value;
|
|
492
|
+
function getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays) {
|
|
493
|
+
return Object.keys(obj).filter(
|
|
494
|
+
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
495
|
+
);
|
|
496
|
+
}
|
|
492
497
|
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
493
498
|
if (typeof obj !== "object" || obj === null)
|
|
494
499
|
return obj;
|
|
@@ -498,9 +503,7 @@ function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
|
498
503
|
const ignoreValues = ["", void 0, null];
|
|
499
504
|
if (ignoreFalse)
|
|
500
505
|
ignoreValues.push(false);
|
|
501
|
-
const definedKeys =
|
|
502
|
-
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
503
|
-
);
|
|
506
|
+
const definedKeys = getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays);
|
|
504
507
|
return Object.assign(
|
|
505
508
|
{},
|
|
506
509
|
...definedKeys.map((key) => {
|