@jmondi/browser-storage
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "@jmondi/browser-storage", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": "Jason Raimondi <jason@raimondi.us>", | ||
@@ -13,2 +13,8 @@ "main": "dist/browser_storage.js", | ||
"description": "", | ||
"dependencies": { | ||
"js-cookie": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/js-cookie": "^3.0.2" | ||
}, | ||
"scripts": { | ||
@@ -18,3 +24,4 @@ "test": "jest", | ||
"build": "tsc" | ||
} | ||
}, | ||
"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```" | ||
} |
@@ -85,3 +85,3 @@ import { AbstractStorage } from "./browser_storage"; | ||
const throwable = () => { | ||
throw new Error("yep"); | ||
throw new Error(); | ||
}; | ||
@@ -88,0 +88,0 @@ JSON.parse = throwable; |
@@ -0,3 +1,5 @@ | ||
import { CookieAdapter } from "./cookie_adapter"; | ||
export abstract class AbstractStorage { | ||
abstract readonly adapter: Storage; | ||
abstract readonly adapter: Storage | CookieAdapter; | ||
@@ -57,1 +59,6 @@ readonly storagePrefix: string; | ||
} | ||
export class CookieStorage extends AbstractStorage { | ||
readonly adapter = new CookieAdapter(); | ||
} | ||
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
6780
1
1
5
135
+ Addedjs-cookie@^3.0.1
+ Addedjs-cookie@3.0.5(transitive)