Registry / storage / storage-easy

storage-easy

JSON →
library2.0.10jsnpmunverified

storage-easy v2.0.10 is a lightweight browser local storage wrapper with cross-domain sharing support. It provides a proxy-based API for reading, writing, incrementing, and deleting cache data with model validation. Key differentiators include namespace isolation, cross-domain Storage via StoreEasy.Cross, and a proxy that auto-syncs with localStorage/sessionStorage. Released as a stable package with monthly updates.

npm install storage-easy
INSTALL
IMPORT
SIG · STORAGE-EASY
S
storage-easy
storagejavascriptv2.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StoreEasy
✓ import StoreEasy from 'storage-easy'
✗ const { StoreEasy } = require('storage-easy')
Default import only; named destructure fails.
new StoreEasy(ns, model)
✓ const easy = new StoreEasy.Cross('ns', model)
✗ const easy = StoreEasy('ns', model)
Constructor must be called with 'new'.
proxy
✓ easy.proxy.person.name.get()
✗ easy.proxy.get('person.name')
Use get method on proxy, not dot notation directly.
empty
✓ easy.empty()
✗ easy.proxy.empty()
empty() on easy resets all, empty() on proxy clears proxy model only.

Initializes Storage Easy with a model, sets and gets values via proxy, increments a counter, and deletes a key.

import StoreEasy from 'storage-easy'; global.$model = { count: 0, user: { name: '' } }; const easy = new StoreEasy('myApp', global.$model); easy.proxy.count = 42; console.log(easy.proxy.count.get()); // 42 easy.proxy.increment('count', 10); console.log(easy.proxy.count.get()); // 52 easy.proxy.user.set('name', 'Alice'); console.log(easy.proxy.user.name.get()); // 'Alice' easy.proxy.delete('count'); console.log(easy.proxy.get()); // { user: { name: 'Alice' } }
Debug
Known issues
gotchaModel must be defined globally as $model before instantiation, otherwise defaults to {}.
fix
Define `global.$model` with your initial data structure.
affects: >=2.0.0
gotchaCross-domain storage requires both domains to use the same namespace and model.
fix
Use `StoreEasy.Cross(ns, model)` on both domains.
affects: >=2.0.0
gotchaproxy.get() returns the entire model object; use proxy.get('key') for nested keys.
fix
Call `proxy.get('key')` instead of `proxy.get()['key']`.
affects: >=2.0.0
gotchaThe proxy object does not support direct property reads (e.g., proxy.user.name); use .get() method.
fix
Replace `proxy.user.name` with `proxy.user.name.get()` or `proxy.get('user.name')`.
affects: >=2.0.0
gotchaempty() on easy resets all namespaces, while empty() on proxy resets only the current proxy's data.
fix
Use `easy.empty()` to reset entire storage; use `proxy.empty()` to clear proxy data only.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: StoreEasy is not a constructor
Forgetting 'new' keyword when instantiating.
fix
Use `new StoreEasy(...)` or `new StoreEasy.Cross(...)`.
TypeError: Cannot read properties of undefined (reading 'get')
Accessing .get() on a proxy property that doesn't exist.
fix
Ensure the key exists in the model or use optional chaining: `proxy.get('key')`.
Uncaught ReferenceError: $model is not defined
Model not defined globally before instantiation.
fix
Define `global.$model = {...}` before creating a StoreEasy instance.
TypeError: proxy.set is not a function
Calling set directly on proxy instead of a nested property.
fix
Use `proxy.someKey.set(value)` or `proxy.set('someKey', value)`.
Upgrade
Version history
2.0.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
33 hits · last 30 days
node
30
OpenAI (training)
1
Resources
storage-easy — npm install storage-easy · libregistry