@domql/state 2.5.164 → 2.5.167
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 +1 -1
- package/dist/cjs/create.js +1 -1
- package/dist/cjs/methods.js +7 -2
- package/methods.js +13 -5
- package/package.json +4 -4
package/create.js
CHANGED
package/dist/cjs/create.js
CHANGED
|
@@ -75,7 +75,7 @@ const checkForTypes = (element) => {
|
|
|
75
75
|
return (0, import_utils.exec)(state, element);
|
|
76
76
|
} else if ((0, import_utils.is)(state)("string", "number")) {
|
|
77
77
|
ref.__state = state;
|
|
78
|
-
return {};
|
|
78
|
+
return { value: state };
|
|
79
79
|
} else if (state === true) {
|
|
80
80
|
ref.__state = element.key;
|
|
81
81
|
return {};
|
package/dist/cjs/methods.js
CHANGED
|
@@ -131,8 +131,13 @@ const toggle = function(key, options = {}) {
|
|
|
131
131
|
};
|
|
132
132
|
const remove = function(key, options = {}) {
|
|
133
133
|
const state = this;
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
if ((0, import_utils.isArray)(state))
|
|
135
|
+
(0, import_utils.removeFromArray)(state, key);
|
|
136
|
+
if ((0, import_utils.isObject)(state))
|
|
137
|
+
(0, import_utils.removeFromObject)(state, key);
|
|
138
|
+
if (options.applyReset)
|
|
139
|
+
return state.set(state.parse(), { replace: true, ...options });
|
|
140
|
+
return state.update();
|
|
136
141
|
};
|
|
137
142
|
const set = function(val, options = {}) {
|
|
138
143
|
const state = this;
|
package/methods.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isArray,
|
|
5
|
+
deepClone,
|
|
6
|
+
isFunction,
|
|
7
|
+
isObject,
|
|
8
|
+
isString,
|
|
9
|
+
removeFromArray,
|
|
10
|
+
removeFromObject
|
|
11
|
+
} from '@domql/utils'
|
|
4
12
|
|
|
5
13
|
import { IGNORE_STATE_PARAMS } from './ignore'
|
|
6
14
|
|
|
@@ -102,10 +110,10 @@ export const toggle = function (key, options = {}) {
|
|
|
102
110
|
|
|
103
111
|
export const remove = function (key, options = {}) {
|
|
104
112
|
const state = this
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
state
|
|
108
|
-
return state.
|
|
113
|
+
if (isArray(state)) removeFromArray(state, key)
|
|
114
|
+
if (isObject(state)) removeFromObject(state, key)
|
|
115
|
+
if (options.applyReset) return state.set(state.parse(), { replace: true, ...options })
|
|
116
|
+
return state.update()
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
export const set = function (val, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/state",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.167",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/event": "^2.5.
|
|
30
|
+
"@domql/event": "^2.5.167",
|
|
31
31
|
"@domql/report": "^2.5.162",
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
32
|
+
"@domql/utils": "^2.5.167"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "3851b6d1029397dcf61c44682be5b9c234993e74"
|
|
35
35
|
}
|