@domql/state 2.5.22 → 2.5.26

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.
@@ -25,6 +25,7 @@ __export(methods_exports, {
25
25
  parentUpdate: () => parentUpdate,
26
26
  parse: () => parse,
27
27
  remove: () => remove,
28
+ reset: () => reset,
28
29
  rootUpdate: () => rootUpdate,
29
30
  set: () => set,
30
31
  toggle: () => toggle
@@ -133,10 +134,14 @@ const set = function(value, options = {}) {
133
134
  const state = this;
134
135
  return state.clean({ preventStateUpdate: true }).update(value, { replace: true, ...options });
135
136
  };
137
+ const reset = function(options = {}) {
138
+ const state = this;
139
+ return state.set(state.parse(), { replace: true, ...options });
140
+ };
136
141
  const apply = function(func, options = {}) {
137
142
  const state = this;
138
143
  if ((0, import_utils.isFunction)(func)) {
139
144
  func(state);
140
- return state.update(state, { replace: true, ...options });
145
+ return state.update(state.parse(), { replace: true, ...options });
141
146
  }
142
147
  };
package/methods.js CHANGED
@@ -113,10 +113,15 @@ export const set = function (value, options = {}) {
113
113
  .update(value, { replace: true, ...options })
114
114
  }
115
115
 
116
+ export const reset = function (options = {}) {
117
+ const state = this
118
+ return state.set(state.parse(), { replace: true, ...options })
119
+ }
120
+
116
121
  export const apply = function (func, options = {}) {
117
122
  const state = this
118
123
  if (isFunction(func)) {
119
124
  func(state)
120
- return state.update(state, { replace: true, ...options })
125
+ return state.update(state.parse(), { replace: true, ...options })
121
126
  }
122
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/state",
3
- "version": "2.5.22",
3
+ "version": "2.5.26",
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": "231fe90e14adace5408e9f5def451463ec1430ae"
34
+ "gitHead": "b17ccc2c09f672ace1ec3b681a82cce26bfce3dd"
35
35
  }