@domql/utils 3.8.6 → 3.8.8
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/if.js +9 -1
- package/dist/cjs/object.js +1 -0
- package/dist/esm/if.js +9 -1
- package/dist/esm/object.js +1 -0
- package/dist/iife/index.js +11 -1
- package/if.js +9 -1
- package/object.js +1 -0
- package/package.json +2 -2
package/dist/cjs/if.js
CHANGED
|
@@ -27,7 +27,15 @@ const createIfConditionFlag = (element, parent) => {
|
|
|
27
27
|
const { __ref: ref } = element;
|
|
28
28
|
const ifVal = element.if;
|
|
29
29
|
if ((0, import_types.isFunction)(ifVal)) {
|
|
30
|
-
|
|
30
|
+
let result;
|
|
31
|
+
try {
|
|
32
|
+
result = ifVal(element, element.state, element.context);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
if (typeof console !== "undefined") console.warn("[DOMQL] if condition error:", e);
|
|
35
|
+
delete ref.__if;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!result) {
|
|
31
39
|
delete ref.__if;
|
|
32
40
|
} else ref.__if = true;
|
|
33
41
|
} else if (ifVal != null && typeof ifVal === "object") {
|
package/dist/cjs/object.js
CHANGED
|
@@ -61,6 +61,7 @@ const _startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 9
|
|
|
61
61
|
const exec = (param, element, state, context) => {
|
|
62
62
|
if ((0, import_types.isFunction)(param)) {
|
|
63
63
|
if (!element) return;
|
|
64
|
+
if (typeof param.call !== "function") return param;
|
|
64
65
|
const result = param.call(
|
|
65
66
|
element,
|
|
66
67
|
element,
|
package/dist/esm/if.js
CHANGED
|
@@ -4,7 +4,15 @@ const createIfConditionFlag = (element, parent) => {
|
|
|
4
4
|
const { __ref: ref } = element;
|
|
5
5
|
const ifVal = element.if;
|
|
6
6
|
if (isFunction(ifVal)) {
|
|
7
|
-
|
|
7
|
+
let result;
|
|
8
|
+
try {
|
|
9
|
+
result = ifVal(element, element.state, element.context);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
if (typeof console !== "undefined") console.warn("[DOMQL] if condition error:", e);
|
|
12
|
+
delete ref.__if;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!result) {
|
|
8
16
|
delete ref.__if;
|
|
9
17
|
} else ref.__if = true;
|
|
10
18
|
} else if (ifVal != null && typeof ifVal === "object") {
|
package/dist/esm/object.js
CHANGED
|
@@ -16,6 +16,7 @@ const _startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 9
|
|
|
16
16
|
const exec = (param, element, state, context) => {
|
|
17
17
|
if (isFunction(param)) {
|
|
18
18
|
if (!element) return;
|
|
19
|
+
if (typeof param.call !== "function") return param;
|
|
19
20
|
const result = param.call(
|
|
20
21
|
element,
|
|
21
22
|
element,
|
package/dist/iife/index.js
CHANGED
|
@@ -164,6 +164,7 @@ var DomqlUtils = (() => {
|
|
|
164
164
|
exec2 = (param, element, state, context) => {
|
|
165
165
|
if (isFunction2(param)) {
|
|
166
166
|
if (!element) return;
|
|
167
|
+
if (typeof param.call !== "function") return param;
|
|
167
168
|
const result = param.call(
|
|
168
169
|
element,
|
|
169
170
|
element,
|
|
@@ -2298,6 +2299,7 @@ var DomqlUtils = (() => {
|
|
|
2298
2299
|
var exec = (param, element, state, context) => {
|
|
2299
2300
|
if (isFunction(param)) {
|
|
2300
2301
|
if (!element) return;
|
|
2302
|
+
if (typeof param.call !== "function") return param;
|
|
2301
2303
|
const result = param.call(
|
|
2302
2304
|
element,
|
|
2303
2305
|
element,
|
|
@@ -2974,7 +2976,15 @@ var DomqlUtils = (() => {
|
|
|
2974
2976
|
const { __ref: ref } = element;
|
|
2975
2977
|
const ifVal = element.if;
|
|
2976
2978
|
if (isFunction(ifVal)) {
|
|
2977
|
-
|
|
2979
|
+
let result;
|
|
2980
|
+
try {
|
|
2981
|
+
result = ifVal(element, element.state, element.context);
|
|
2982
|
+
} catch (e) {
|
|
2983
|
+
if (typeof console !== "undefined") console.warn("[DOMQL] if condition error:", e);
|
|
2984
|
+
delete ref.__if;
|
|
2985
|
+
return;
|
|
2986
|
+
}
|
|
2987
|
+
if (!result) {
|
|
2978
2988
|
delete ref.__if;
|
|
2979
2989
|
} else ref.__if = true;
|
|
2980
2990
|
} else if (ifVal != null && typeof ifVal === "object") {
|
package/if.js
CHANGED
|
@@ -8,7 +8,15 @@ export const createIfConditionFlag = (element, parent) => {
|
|
|
8
8
|
const ifVal = element.if
|
|
9
9
|
|
|
10
10
|
if (isFunction(ifVal)) {
|
|
11
|
-
|
|
11
|
+
let result
|
|
12
|
+
try {
|
|
13
|
+
result = ifVal(element, element.state, element.context)
|
|
14
|
+
} catch (e) {
|
|
15
|
+
if (typeof console !== 'undefined') console.warn('[DOMQL] if condition error:', e)
|
|
16
|
+
delete ref.__if
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
if (!result) {
|
|
12
20
|
delete ref.__if
|
|
13
21
|
} else ref.__if = true
|
|
14
22
|
} else if (ifVal != null && typeof ifVal === 'object') {
|
package/object.js
CHANGED
|
@@ -21,6 +21,7 @@ const _startsWithDunder = e => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 95
|
|
|
21
21
|
export const exec = (param, element, state, context) => {
|
|
22
22
|
if (isFunction(param)) {
|
|
23
23
|
if (!element) return
|
|
24
|
+
if (typeof param.call !== 'function') return param
|
|
24
25
|
const result = param.call(
|
|
25
26
|
element,
|
|
26
27
|
element,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.8",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@symbo.ls/fetch": "^3.8.
|
|
41
|
+
"@symbo.ls/fetch": "^3.8.8"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@symbo.ls/fetch": {
|