@wxn0brp/vql 0.3.10 → 0.3.11

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.
@@ -26,25 +26,25 @@ function pathFix(vql) {
26
26
  }
27
27
  }
28
28
  function replaceVariables(obj, variables) {
29
+ if (typeof obj === "object" && !Array.isArray(obj) && obj !== null && "__" in obj) {
30
+ const varKey = obj.__;
31
+ return variables[varKey] ?? obj;
32
+ }
29
33
  if (typeof obj === "string") {
30
- if (obj.startsWith("$")) {
31
- return variables[obj.slice(1)] || variables[obj];
32
- }
34
+ if (obj.startsWith("$"))
35
+ return variables[obj.slice(1)] ?? obj;
33
36
  return obj;
34
37
  }
35
- else if (Array.isArray(obj)) {
38
+ if (Array.isArray(obj))
36
39
  return obj.map((item) => replaceVariables(item, variables));
37
- }
38
- else if (typeof obj === "object") {
40
+ if (typeof obj === "object" && obj !== null) {
39
41
  const newObj = {};
40
42
  for (const key in obj) {
41
43
  newObj[key] = replaceVariables(obj[key], variables);
42
44
  }
43
45
  return newObj;
44
46
  }
45
- else {
46
- return obj;
47
- }
47
+ return obj;
48
48
  }
49
49
  export function executeSheet(query, preDefinedSheets) {
50
50
  if ("ref" in query) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/vql",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "main": "dist/index.js",
5
5
  "author": "wxn0brP",
6
6
  "license": "MIT",