@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webreflection/utils",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "types": {
6
6
  "./all": "./types/all.d.ts",
@@ -97,7 +97,7 @@ export default class JSONStorage {
97
97
  */
98
98
  get(key) {
99
99
  const value = this.#storage.getItem(key);
100
- return typeof value === 'string' ? this.#parse(value) : void 0;
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
- this.#storage.setItem(key, this.#stringify(value));
138
+ const str = this.#stringify(value);
139
+ if (str != null) this.#storage.setItem(key, str);
139
140
  return this;
140
141
  }
141
142