@domql/state 2.5.3 → 2.5.9

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/create.js CHANGED
@@ -53,20 +53,18 @@ const checkForTypes = (element) => {
53
53
  if (isFunction(state)) {
54
54
  ref.__state = state
55
55
  return exec(state, element)
56
- }
57
- if (is(state)('string', 'number')) {
56
+ } else if (is(state)('string', 'number')) {
58
57
  ref.__state = state
59
58
  return {}
60
- }
61
- if (state === true) {
59
+ } else if (state === true) {
62
60
  ref.__state = element.key
63
61
  return {}
64
- }
65
- if (state) {
62
+ } else if (state) {
66
63
  ref.__hasRootState = true
67
64
  return state
65
+ } else {
66
+ return false
68
67
  }
69
- return false
70
68
  }
71
69
 
72
70
  const addProtoToArray = (state, proto) => {
@@ -66,20 +66,18 @@ const checkForTypes = (element) => {
66
66
  if ((0, import_utils.isFunction)(state)) {
67
67
  ref.__state = state;
68
68
  return (0, import_utils.exec)(state, element);
69
- }
70
- if ((0, import_utils.is)(state)("string", "number")) {
69
+ } else if ((0, import_utils.is)(state)("string", "number")) {
71
70
  ref.__state = state;
72
71
  return {};
73
- }
74
- if (state === true) {
72
+ } else if (state === true) {
75
73
  ref.__state = element.key;
76
74
  return {};
77
- }
78
- if (state) {
75
+ } else if (state) {
79
76
  ref.__hasRootState = true;
80
77
  return state;
78
+ } else {
79
+ return false;
81
80
  }
82
- return false;
83
81
  };
84
82
  const addProtoToArray = (state, proto) => {
85
83
  for (const key in proto) {
@@ -30,8 +30,8 @@ const STATE_UPDATE_OPTIONS = {
30
30
  overwrite: true,
31
31
  preventHoistElementUpdate: false,
32
32
  updateByState: true,
33
- execStateFunction: true,
34
33
  isHoisted: true,
34
+ execStateFunction: true,
35
35
  stateFunctionOverwrite: true
36
36
  };
37
37
  const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
package/inherit.js CHANGED
@@ -68,6 +68,7 @@ export const createInheritedState = (element, parent) => {
68
68
  export const checkIfInherits = (element) => {
69
69
  const ref = element.__ref
70
70
  const stateKey = ref.__state
71
+
71
72
  if (!stateKey || isNot(stateKey)('number', 'string')) return false
72
73
  return true
73
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.3",
3
+ "version": "2.5.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -31,5 +31,5 @@
31
31
  "@domql/report": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "8a498068958fca26ce39c39e6ad1312d0be327d7"
34
+ "gitHead": "72ca0c34d453da80307f93c6e3b214c5cbf03a66"
35
35
  }
package/updateState.js CHANGED
@@ -10,8 +10,8 @@ const STATE_UPDATE_OPTIONS = {
10
10
  overwrite: true,
11
11
  preventHoistElementUpdate: false,
12
12
  updateByState: true,
13
- execStateFunction: true,
14
13
  isHoisted: true,
14
+ execStateFunction: true,
15
15
  stateFunctionOverwrite: true
16
16
  }
17
17