@domql/utils 2.5.100 → 2.5.101
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 +14 -2
- package/object.js +15 -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,18 @@ 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
|
+
};
|
|
539
|
+
const getExtendsInElement = (obj) => {
|
|
528
540
|
let result = [];
|
|
529
541
|
function traverse(o) {
|
|
530
542
|
for (const key in o) {
|
package/object.js
CHANGED
|
@@ -601,7 +601,21 @@ 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
|
+
|
|
618
|
+
export const getExtendsInElement = (obj) => {
|
|
605
619
|
let result = []
|
|
606
620
|
|
|
607
621
|
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.101",
|
|
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": "5a5e8988f25e9a77e44596d9fd23e8a00b725685",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.12.0"
|
|
29
29
|
}
|