@jmondi/browser-storage
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "@jmondi/browser-storage", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Jason Raimondi <jason@raimondi.us>", | ||
@@ -20,7 +20,6 @@ "main": "dist/browser_storage.js", | ||
"scripts": { | ||
"test": "jest", | ||
"test": "vitest run", | ||
"build": "tsc", | ||
"prepublish": "rm -rf ./dist && pnpm test && pnpm build" | ||
}, | ||
"readme": "# @jmondi/browser-storage\n\nSupports null and serializable objects.\n\n## Install\n\n```bash\nnpm install @jmondi/browser-storage\n```\n\n## Usage \n\n### Local Storage\n\nLocal storage is persistent after close.\n\n```typescript\nimport { LocalStorage } from \"@jmondi/browser-storage\";\n\nconst localStorage = new LocalStorage();\n\nlocalStorage.set(\"user1\", null);\nlocalStorage.set(\"user2\", { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" });\n\nconsole.log(localStorage.get(\"user1\"));\n// null\nconsole.log(localStorage.get(\"user2\"));\n// { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" }\n```\n\n### Session Storage\n\nSession storage is reset when the browser is closed.\n\n```typescript\nimport { SessionStorage } from \"@jmondi/browser-storage\";\n\nconst sessionStorage = new SessionStorage();\n\nsessionStorage.set(\"user1\", null);\nsessionStorage.set(\"user2\", { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" });\n\nconsole.log(sessionStorage.get(\"user1\"));\n// null\nconsole.log(sessionStorage.get(\"user2\"));\n// { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" }\n```\n\n### Cookie Storage\n\nCookie storage is more configurable, see https://github.com/js-cookie/js-cookie#cookie-attributes for full options\n\n```typescript\nimport type { CookieAttributes } from \"js-cookie\";\nimport { CookieStorage } from \"@jmondi/browser-storage\";\n\nconst cookieStorage = new CookieStorage();\n\nconst cookieOptions: CookieAttributes = {};\n\ncookieStorage.set(\"user1\", null, cookieOptions);\ncookieStorage.set(\"user2\", { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" });\n\nconsole.log(cookieStorage.get(\"user1\"));\n// null\nconsole.log(cookieStorage.get(\"user2\"));\n// { email: \"hermoine@hogwarts.com\", name: \"Hermoine\" }\n```\n" | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
import { describe, beforeEach, it, expect } from "vitest"; | ||
import { AbstractStorage } from "./browser_storage"; | ||
@@ -2,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
229
31490