Skip to content

Commit ba8bae6

Browse files
author
brizental
committed
Attend to review comments
1 parent de3dcb6 commit ba8bae6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/storage/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff 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+
*/
3644
export 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

4957
export interface Store {

src/storage/persistent/webext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
*/
1717
class WebExtStore implements Store {

0 commit comments

Comments
 (0)