1
Fork 0

Compare commits

...

6 Commits
0.1.0 ... main

Author SHA1 Message Date
Bauke 137c8eb290
Remove unused assertion and variable declaration. 2023-12-03 13:22:03 +01:00
Bauke f4fa51251e
Fix linting issues. 2023-12-02 13:11:32 +01:00
Bauke dd3eb83ed8
Update dependencies. 2023-12-02 13:07:53 +01:00
Bauke 01792d43d2
Version 0.2.0! 2022-12-28 13:51:16 +01:00
Bauke c464983440
Remove readonly from Value properties. 2022-12-28 12:36:06 +01:00
Bauke 9fc2dbcbcb
Export ValueOptions<T>. 2022-12-28 12:35:46 +01:00
6 changed files with 2969 additions and 2467 deletions

View File

@ -1,5 +1,4 @@
import process from "node:process";
import {build} from "esbuild";
import {cmd} from "web-ext";

View File

@ -2,7 +2,7 @@
"name": "@holllo/webextension-storage",
"description": "Ergonomic WebExtension storage helper.",
"license": "AGPL-3.0-or-later",
"version": "0.1.0",
"version": "0.2.0",
"type": "module",
"homepage": "https://git.bauke.xyz/Holllo/webextension-storage",
"bugs": {
@ -26,17 +26,17 @@
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@bauke/eslint-config": "^0.1.2",
"@bauke/prettier-config": "^0.1.2",
"@holllo/test": "^0.1.0",
"@types/node": "^18.11.17",
"@types/webextension-polyfill": "^0.9.2",
"esbuild": "^0.16.8",
"tsx": "^3.12.1",
"typescript": "^4.9.4",
"web-ext": "^7.4.0",
"@bauke/eslint-config": "^0.1.4",
"@bauke/prettier-config": "^0.1.4",
"@holllo/test": "^0.2.1",
"@types/node": "^20.10.2",
"@types/webextension-polyfill": "^0.10.7",
"esbuild": "^0.19.8",
"tsx": "^4.6.2",
"typescript": "^5.3.2",
"web-ext": "^7.8.0",
"webextension-polyfill": "^0.10.0",
"xo": "^0.53.1"
"xo": "^0.56.0"
},
"prettier": "@bauke/prettier-config",
"xo": {

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ import browser from "webextension-polyfill";
export type StorageArea = browser.Storage.StorageArea;
type ValueOptions<T> = {
export type ValueOptions<T> = {
/** A function to convert a string to the type `T`. */
deserialize: (input: string) => T;
/** The key to use for storage. */
@ -35,10 +35,10 @@ export async function createValue<T>(
type Props<T> = Required<ValueOptions<T>>;
export class Value<T> implements Props<T> {
public readonly deserialize: Props<T>["deserialize"];
public readonly key: Props<T>["key"];
public readonly serialize: Props<T>["serialize"];
public readonly storage: Props<T>["storage"];
public deserialize: Props<T>["deserialize"];
public key: Props<T>["key"];
public serialize: Props<T>["serialize"];
public storage: Props<T>["storage"];
private inner: Props<T>["value"];

View File

@ -1,5 +1,4 @@
import browser from "webextension-polyfill";
import {createValue} from "../build/index.js";
const updatedDate = await createValue<Date>({

View File

@ -1,6 +1,5 @@
import {setup, type TestContext} from "@holllo/test";
import browser from "webextension-polyfill";
import {createValue, type Value} from "../source/index.js";
const create = async <T>(
@ -34,10 +33,10 @@ const sampleObject: SampleObject = {
status: "passed",
};
const group = await setup("Value<T>", async (group) => {
await setup("Value<T>", async (group) => {
const samples = [
["number", "testNumber", Math.PI],
["string", "testString", "A string to test with!" as string],
["string", "testString", "A string to test with!"],
["SampleObject", "testSampleObject", sampleObject],
] as const;