@domql/utils 2.5.100 → 2.5.107
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/cjs/object.js +20 -2
- package/object.js +22 -1
- package/package.json +2 -2
package/dist/cjs/object.js
CHANGED
|
@@ -34,8 +34,9 @@ __export(object_exports, {
|
|
|
34
34
|
diffArrays: () => diffArrays,
|
|
35
35
|
diffObjects: () => diffObjects,
|
|
36
36
|
exec: () => exec,
|
|
37
|
-
findExtendsInElement: () => findExtendsInElement,
|
|
38
37
|
flattenRecursive: () => flattenRecursive,
|
|
38
|
+
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
39
|
+
getExtendsInElement: () => getExtendsInElement,
|
|
39
40
|
hasOwnProperty: () => hasOwnProperty,
|
|
40
41
|
isEmpty: () => isEmpty,
|
|
41
42
|
isEmptyObject: () => isEmptyObject,
|
|
@@ -524,7 +525,24 @@ const checkIfKeyIsComponent = (key) => {
|
|
|
524
525
|
const firstCharKey = key.slice(0, 1);
|
|
525
526
|
return /^[A-Z]*$/.test(firstCharKey);
|
|
526
527
|
};
|
|
527
|
-
const
|
|
528
|
+
const getChildrenComponentsByKey = (key, el) => {
|
|
529
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
530
|
+
return el;
|
|
531
|
+
}
|
|
532
|
+
if (el.extend) {
|
|
533
|
+
const foundString = (0, import_types.isString)(el.extend) && el.extend === key;
|
|
534
|
+
const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
|
|
535
|
+
if (foundString || foundInArray)
|
|
536
|
+
return el;
|
|
537
|
+
}
|
|
538
|
+
if (el.parent && el.parent.childExtend) {
|
|
539
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
540
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
541
|
+
if (foundString || foundInArray)
|
|
542
|
+
return el;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const getExtendsInElement = (obj) => {
|
|
528
546
|
let result = [];
|
|
529
547
|
function traverse(o) {
|
|
530
548
|
for (const key in o) {
|
package/object.js
CHANGED
|
@@ -601,7 +601,28 @@ export const checkIfKeyIsComponent = (key) => {
|
|
|
601
601
|
return /^[A-Z]*$/.test(firstCharKey)
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
-
export const
|
|
604
|
+
export const getChildrenComponentsByKey = (key, el) => {
|
|
605
|
+
if (key === el.key || el.__ref.__componentKey === key) {
|
|
606
|
+
return el
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// Check if the prop is "extend" and it's either a string or an array
|
|
610
|
+
if (el.extend) {
|
|
611
|
+
// Add the value of the extend key to the result array
|
|
612
|
+
const foundString = isString(el.extend) && el.extend === key
|
|
613
|
+
const foundInArray = isArray(el.extend) && el.extend.filter(v => v === key).length
|
|
614
|
+
if (foundString || foundInArray) return el
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (el.parent && el.parent.childExtend) {
|
|
618
|
+
// Add the value of the extend key to the result array
|
|
619
|
+
const foundString = isString(el.parent.childExtend) && el.parent.childExtend === key
|
|
620
|
+
const foundInArray = isArray(el.parent.childExtend) && el.parent.childExtend.filter(v => v === key).length
|
|
621
|
+
if (foundString || foundInArray) return el
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export const getExtendsInElement = (obj) => {
|
|
605
626
|
let result = []
|
|
606
627
|
|
|
607
628
|
function traverse (o) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.107",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "yarn build:cjs",
|
|
24
24
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "a313ce03e61603c66db67f1264c172805edb273e",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.12.0"
|
|
29
29
|
}
|