@jmondi/browser-storage
Advanced tools
Comparing version 1.2.0 to 1.3.0-alpha.0
{ | ||
"module": "./esm/mod.js", | ||
"main": "./script/mod.js", | ||
"name": "@jmondi/browser-storage", | ||
"version": "1.2.0", | ||
"version": "1.3.0-alpha.0", | ||
"description": "Utilities for local and session browser storage.", | ||
"keywords": [ | ||
"browser-storage", | ||
"local-storage", | ||
"session-storage" | ||
], | ||
"author": "Jason Raimondi <jason@raimondi.us>", | ||
"main": "dist/browser_storage.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"keywords": [], | ||
"license": "MIT", | ||
"description": "Util functions for local and session storage that handles namespacing as well as json serializing and parsing values.", | ||
"dependencies": { | ||
"js-cookie": "^3.0.1", | ||
"superjson": "^1.11.0" | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jasonraimondi/browser-storage.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/jasonraimondi/browser-storage/issues" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./esm/mod.js", | ||
"require": "./script/mod.js" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/js-cookie": "^3.0.2" | ||
}, | ||
"scripts": { | ||
"test": "vitest run", | ||
"build": "tsc", | ||
"prepublish": "rm -rf ./dist && pnpm test && pnpm build" | ||
"@types/node": "^18.11.9" | ||
} | ||
} |
@@ -1,68 +0,13 @@ | ||
# @jmondi/browser-storage | ||
# DateDuration | ||
Supports null and serializable objects. | ||
## Install (npm) | ||
## Install | ||
```bash | ||
npm install @jmondi/browser-storage | ||
pnpm add @jmondi/browser-storage | ||
``` | ||
## Usage | ||
### Deno | ||
### Local Storage | ||
Local storage is persistent after close. | ||
```typescript | ||
import { LocalStorage } from "@jmondi/browser-storage"; | ||
const localStorage = new LocalStorage(); | ||
localStorage.set("user1", null); | ||
localStorage.set("user2", { email: "hermoine@hogwarts.com", name: "Hermoine" }); | ||
console.log(localStorage.get("user1")); | ||
// null | ||
console.log(localStorage.get("user2")); | ||
// { email: "hermoine@hogwarts.com", name: "Hermoine" } | ||
```ts | ||
import { DateDuration } from "https://deno.land/x/browser_storage"; | ||
``` | ||
### Session Storage | ||
Session storage is reset when the browser is closed. | ||
```typescript | ||
import { SessionStorage } from "@jmondi/browser-storage"; | ||
const sessionStorage = new SessionStorage(); | ||
sessionStorage.set("user1", null); | ||
sessionStorage.set("user2", { email: "hermoine@hogwarts.com", name: "Hermoine" }); | ||
console.log(sessionStorage.get("user1")); | ||
// null | ||
console.log(sessionStorage.get("user2")); | ||
// { email: "hermoine@hogwarts.com", name: "Hermoine" } | ||
``` | ||
### Cookie Storage | ||
Cookie storage is more configurable, see https://github.com/js-cookie/js-cookie#cookie-attributes for full options | ||
```typescript | ||
import type { CookieAttributes } from "js-cookie"; | ||
import { CookieStorage } from "@jmondi/browser-storage"; | ||
const cookieStorage = new CookieStorage(); | ||
const cookieOptions: CookieAttributes = {}; | ||
cookieStorage.set("user1", null, cookieOptions); | ||
cookieStorage.set("user2", { email: "hermoine@hogwarts.com", name: "Hermoine" }); | ||
console.log(cookieStorage.get("user1")); | ||
// null | ||
console.log(cookieStorage.get("user2")); | ||
// { email: "hermoine@hogwarts.com", name: "Hermoine" } | ||
``` |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
0
13
321
0
0
11258
2
14
1
- Removedjs-cookie@^3.0.1
- Removedsuperjson@^1.11.0
- Removedcopy-anything@3.0.5(transitive)
- Removedis-what@4.1.16(transitive)
- Removedjs-cookie@3.0.5(transitive)
- Removedsuperjson@1.13.3(transitive)