File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -33,17 +33,25 @@ export interface StorageObject {
3333 [ key : string ] : StorageValue ;
3434}
3535
36+ /**
37+ * Verifies if a given value is a valid StorageValue.
38+ *
39+ * @param v The value to verify
40+ *
41+ * @returns A special Typescript value (which compiles down to a boolean)
42+ * stating wether `v` is a valid StorageValue.
43+ */
3644export function isStorageValue ( v : unknown ) : v is StorageValue {
3745 if ( isUndefined ( v ) || isString ( v ) ) {
3846 return true ;
39- } else if ( isObject ( v ) ) {
47+ }
48+
49+ if ( isObject ( v ) ) {
4050 for ( const key in v ) {
4151 return isStorageValue ( v [ key ] ) ;
4252 }
43- } else {
44- return false ;
4553 }
46- return true ;
54+ return false ;
4755}
4856
4957export interface Store {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { isObject } from "utils";
1111 * [storage API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage)
1212 * for web extensions.
1313 *
14- * To make sure this implementation works on Chrome , the user must install the peer dependency
14+ * To make sure this implementation works on Chromium based browsers , the user must install the peer dependency
1515 * [`mozilla/webextension-polyfill`](https://github.com/mozilla/webextension-polyfill).
1616 */
1717class WebExtStore implements Store {
You can’t perform that action at this time.
0 commit comments