tods-competition-factory 1.9.0 → 1.9.2
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 +23 -21
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +9 -17
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +16 -29
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +6 -25
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +80 -73
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +103 -114
- 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 +10 -10
package/dist/forge/utilities.mjs
CHANGED
|
@@ -306,7 +306,6 @@ function handleCaughtError({
|
|
|
306
306
|
const globalState = {
|
|
307
307
|
tournamentFactoryVersion: "0.0.0",
|
|
308
308
|
timers: { default: { elapsedTime: 0 } },
|
|
309
|
-
iterators: { makeDeepCopy: 0 },
|
|
310
309
|
deepCopyAttributes: {
|
|
311
310
|
stringify: [],
|
|
312
311
|
ignore: [],
|
|
@@ -315,20 +314,6 @@ const globalState = {
|
|
|
315
314
|
deepCopy: true
|
|
316
315
|
};
|
|
317
316
|
let _globalStateProvider = syncGlobalState$1;
|
|
318
|
-
function getDevContext(contextCriteria) {
|
|
319
|
-
if (!contextCriteria || typeof contextCriteria !== "object") {
|
|
320
|
-
return globalState.devContext ?? false;
|
|
321
|
-
} else {
|
|
322
|
-
if (typeof globalState.devContext !== "object")
|
|
323
|
-
return false;
|
|
324
|
-
return Object.keys(contextCriteria).every(
|
|
325
|
-
(key) => globalState.devContext?.[key] === contextCriteria[key]
|
|
326
|
-
) && globalState.devContext;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function setDeepCopyIterations(value) {
|
|
330
|
-
globalState.iterators.makeDeepCopy = value;
|
|
331
|
-
}
|
|
332
317
|
function deepCopyEnabled() {
|
|
333
318
|
return {
|
|
334
319
|
enabled: globalState.deepCopy,
|
|
@@ -361,13 +346,6 @@ function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtens
|
|
|
361
346
|
if (!deepCopy?.enabled && !internalUse || typeof sourceObject !== "object" || typeof sourceObject === "function" || sourceObject === null || typeof deepCopy?.threshold === "number" && iteration >= deepCopy.threshold) {
|
|
362
347
|
return sourceObject;
|
|
363
348
|
}
|
|
364
|
-
const devContext = getDevContext({ makeDeepCopy: true });
|
|
365
|
-
if (devContext) {
|
|
366
|
-
setDeepCopyIterations(iteration);
|
|
367
|
-
if (typeof devContext === "object" && (iteration > (devContext.iterationThreshold || 15) || devContext.firstIteration && iteration === 0) && devContext.log && (!devContext.notInternalUse || devContext.notInternalUse && !internalUse)) {
|
|
368
|
-
console.log({ devContext, iteration, internalUse }, sourceObject);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
349
|
const targetObject = Array.isArray(sourceObject) ? [] : {};
|
|
372
350
|
const sourceObjectKeys = Object.keys(sourceObject).filter(
|
|
373
351
|
(key) => !internalUse || !ignore || Array.isArray(ignore) && !ignore.includes(key) || typeof ignore === "function" && !ignore(key)
|
|
@@ -489,6 +467,11 @@ const extractAttributes = (accessor) => (element) => !accessor || typeof element
|
|
|
489
467
|
})) || typeof accessor === "object" && Object.keys(accessor).map((key) => ({
|
|
490
468
|
[key]: getAccessorValue({ element, accessor: key })?.value
|
|
491
469
|
})) || (typeof accessor === "string" && getAccessorValue({ element, accessor }))?.value;
|
|
470
|
+
function getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays) {
|
|
471
|
+
return Object.keys(obj).filter(
|
|
472
|
+
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
473
|
+
);
|
|
474
|
+
}
|
|
492
475
|
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
493
476
|
if (typeof obj !== "object" || obj === null)
|
|
494
477
|
return obj;
|
|
@@ -498,9 +481,7 @@ function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
|
498
481
|
const ignoreValues = ["", void 0, null];
|
|
499
482
|
if (ignoreFalse)
|
|
500
483
|
ignoreValues.push(false);
|
|
501
|
-
const definedKeys =
|
|
502
|
-
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
503
|
-
);
|
|
484
|
+
const definedKeys = getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays);
|
|
504
485
|
return Object.assign(
|
|
505
486
|
{},
|
|
506
487
|
...definedKeys.map((key) => {
|