@webreflection/utils 0.2.21 → 0.2.22
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/package.json +1 -1
- package/src/json-storage.js +3 -2
package/package.json
CHANGED
package/src/json-storage.js
CHANGED
|
@@ -97,7 +97,7 @@ export default class JSONStorage {
|
|
|
97
97
|
*/
|
|
98
98
|
get(key) {
|
|
99
99
|
const value = this.#storage.getItem(key);
|
|
100
|
-
return
|
|
100
|
+
return value != null ? this.#parse(value) : void 0;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -135,7 +135,8 @@ export default class JSONStorage {
|
|
|
135
135
|
* @returns {this}
|
|
136
136
|
*/
|
|
137
137
|
set(key, value) {
|
|
138
|
-
|
|
138
|
+
const str = this.#stringify(value);
|
|
139
|
+
if (str != null) this.#storage.setItem(key, str);
|
|
139
140
|
return this;
|
|
140
141
|
}
|
|
141
142
|
|