Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@
}
],
"semi": ["error", "always"],
"no-debugger": ["error"]
"no-debugger": ["error"],
"jsdoc/no-types": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off"
},
"extends": [
"plugin:jsdoc/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
Expand Down
2 changes: 1 addition & 1 deletion src/storage/persistent/webext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class WebExtStore implements Store {
*
* @param index The index to the given entry on the storage.
*
* @return The query object.
* @returns The query object.
*/
private _buildQuery(index: StorageIndex): WebExtStoreQuery {
let partialQuery = null;
Expand Down
24 changes: 24 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,38 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
* Checks whether or not `v` is a simple data object.
*
* @param v The value to verify.
*
* @returns A special Typescript value (which compiles down to a boolean)
* stating wether `v` is a valid data object.
*/
export function isObject(v: unknown): v is Record<string | number | symbol, unknown> {
return (v && typeof v === "object" && v.constructor === Object);
}

/**
* Checks whether or not `v` is undefined.
*
* @param v The value to verify.
*
* @returns A special Typescript value (which compiles down to a boolean)
* stating wether `v` is undefined.
*/
export function isUndefined(v: unknown): v is undefined {
return typeof v === "undefined";
}

/**
* Checks whether or not `v` is a string.
*
* @param v The value to verify.
*
* @returns A special Typescript value (which compiles down to a boolean)
* stating wether `v` is a string.
*/
export function isString(v: unknown): v is string {
return (v && (typeof v === "string" || (v === "object" && v.constructor === String)));
}
2 changes: 2 additions & 0 deletions tests/utils/webext/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export async function setupFirefox(headless: boolean): Promise<WebDriver> {
* @param browser A Webdriver where we will run this proxied script
* @param method The method which we want to execute.
* This array will work exactly like the StorageIndex.
*
* @returns A proxy function for the given browser method.
*/
export function webExtensionAPIProxyBuilder(browser: WebDriver, method: string[]) {
return async function (...args: never[]): Promise<any> {
Expand Down