@domql/state 2.5.90 → 2.5.122

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.
@@ -55,7 +55,7 @@ const parse = function() {
55
55
  const clean = function(options = {}) {
56
56
  const state = this;
57
57
  for (const param in state) {
58
- if (!import_ignore.IGNORE_STATE_PARAMS.includes(param)) {
58
+ if (!import_ignore.IGNORE_STATE_PARAMS.includes(param) && Object.hasOwnProperty.call(state, param)) {
59
59
  delete state[param];
60
60
  }
61
61
  }
@@ -165,7 +165,7 @@ const applyFunction = function(func, options = {}) {
165
165
  };
166
166
  const quietUpdate = function(obj, options = {}) {
167
167
  const state = this;
168
- return state.update(obj, { preventUpdate: true, options });
168
+ return state.update(obj, { preventUpdate: true, ...options });
169
169
  };
170
170
  const replace = function(obj, options = {}) {
171
171
  const state = this;
@@ -176,5 +176,5 @@ const replace = function(obj, options = {}) {
176
176
  };
177
177
  const quietReplace = function(obj, options = {}) {
178
178
  const state = this;
179
- return state.replace(obj, { preventUpdate: true, options });
179
+ return state.replace(obj, { preventUpdate: true, ...options });
180
180
  };
@@ -36,6 +36,8 @@ const STATE_UPDATE_OPTIONS = {
36
36
  const updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
37
37
  const state = this;
38
38
  const element = state.__element;
39
+ if (options.onEach)
40
+ options.onEach(element, state, element.context, options);
39
41
  if (!options.updateByState)
40
42
  (0, import_utils.merge)(options, STATE_UPDATE_OPTIONS);
41
43
  if (!state.__element)
package/methods.js CHANGED
@@ -22,7 +22,7 @@ export const parse = function () {
22
22
  export const clean = function (options = {}) {
23
23
  const state = this
24
24
  for (const param in state) {
25
- if (!IGNORE_STATE_PARAMS.includes(param)) {
25
+ if (!IGNORE_STATE_PARAMS.includes(param) && Object.hasOwnProperty.call(state, param)) {
26
26
  delete state[param]
27
27
  }
28
28
  }
@@ -147,7 +147,7 @@ export const applyFunction = function (func, options = {}) {
147
147
 
148
148
  export const quietUpdate = function (obj, options = {}) {
149
149
  const state = this
150
- return state.update(obj, { preventUpdate: true, options })
150
+ return state.update(obj, { preventUpdate: true, ...options })
151
151
  }
152
152
 
153
153
  export const replace = function (obj, options = {}) {
@@ -162,5 +162,5 @@ export const replace = function (obj, options = {}) {
162
162
 
163
163
  export const quietReplace = function (obj, options = {}) {
164
164
  const state = this
165
- return state.replace(obj, { preventUpdate: true, options })
165
+ return state.replace(obj, { preventUpdate: true, ...options })
166
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.90",
3
+ "version": "2.5.122",
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": "01113bfc2fb3bc1f4fc3b694a45cb397ee65ae68"
34
+ "gitHead": "2f048372ece4d808cfaca8e43491611dafe3ad5f"
35
35
  }
package/updateState.js CHANGED
@@ -18,6 +18,8 @@ export const updateState = function (obj, options = STATE_UPDATE_OPTIONS) {
18
18
  const state = this
19
19
  const element = state.__element
20
20
 
21
+ if (options.onEach) options.onEach(element, state, element.context, options)
22
+
21
23
  if (!options.updateByState) merge(options, STATE_UPDATE_OPTIONS)
22
24
 
23
25
  if (!state.__element) report('ElementOnStateIsNotDefined')