@domql/state 2.3.145 → 2.3.148

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.
@@ -47,12 +47,13 @@ const getChildStateInKey = (stateKey, parentState, options = {}) => {
47
47
  for (let i = 0; i < arrLength; i++) {
48
48
  const childKey = arr[i];
49
49
  const grandChildKey = arr[i + 1];
50
- const childInParent = parentState[childKey];
51
- if (childInParent && childInParent[grandChildKey]) {
52
- stateKey = grandChildKey;
53
- parentState = childInParent;
54
- } else
55
- return;
50
+ let childInParent = parentState[childKey];
51
+ if (!childInParent)
52
+ childInParent = parentState[childKey] = {};
53
+ if (!childInParent[grandChildKey])
54
+ childInParent[grandChildKey] = {};
55
+ stateKey = grandChildKey;
56
+ parentState = childInParent;
56
57
  }
57
58
  if (options.returnParent)
58
59
  return parentState;
package/inherit.js CHANGED
@@ -20,11 +20,13 @@ export const getChildStateInKey = (stateKey, parentState, options = {}) => {
20
20
  for (let i = 0; i < arrLength; i++) {
21
21
  const childKey = arr[i]
22
22
  const grandChildKey = arr[i + 1]
23
- const childInParent = parentState[childKey]
24
- if (childInParent && childInParent[grandChildKey]) {
25
- stateKey = grandChildKey
26
- parentState = childInParent
27
- } else return
23
+
24
+ let childInParent = parentState[childKey]
25
+ if (!childInParent) childInParent = parentState[childKey] = {}
26
+ if (!childInParent[grandChildKey]) childInParent[grandChildKey] = {}
27
+
28
+ stateKey = grandChildKey
29
+ parentState = childInParent
28
30
  }
29
31
  if (options.returnParent) return parentState
30
32
  return parentState[stateKey]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.3.145",
3
+ "version": "2.3.148",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -26,5 +26,5 @@
26
26
  "@domql/report": "latest",
27
27
  "@domql/utils": "latest"
28
28
  },
29
- "gitHead": "4f0a5e6e5d09df0f83be2aa4ae26dc5a66faa37b"
29
+ "gitHead": "de4e989bbd734a02763ba4d4c9279f9fbb060b03"
30
30
  }