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.
local
✓ import { local } from 'superstore-sync'
✗ const local = require('superstore-sync').local
ESM-style import since v2; avoid CommonJS destructuring if using ESM.
session
✓ import { session } from 'superstore-sync'
✗ var store = require('superstore-sync'); store.session
Both local and session can be imported as named exports.
isPersisting
✓ import { isPersisting } from 'superstore-sync'
✗ const store = require('superstore-sync'); store.isPersisting
isPersisting is also a named export; v2 supports named imports.
default
✓ import store from 'superstore-sync'
✗ const store = require('superstore-sync').default
Default export is the module itself; no .default needed with ESM.
Shows how to use local, session, isPersisting, clear, unset with automatic JSON handling.
import { local, session, isPersisting } from 'superstore-sync';
// Set and get from local storage
local.set('name', { first: 'Alice', last: 'Smith' });
const name = local.get('name');
console.log(name.first); // 'Alice'
// Set and get from session storage
session.set('sessionId', 12345);
const id = session.get('sessionId');
console.log(id); // 12345
// Clear all keys starting with 'foo'
local.clear('foo');
// Check persistence status
console.log(isPersisting()); // true unless storage is full/unavailable
// Remove a specific key
local.unset('name');
// Unset from session
session.unset('sessionId');
Errors
Common errors & fixes
TypeError: local.get is not a function
Using destructuring with CommonJS require: const { local } = require('superstore-sync')
fixUse const store = require('superstore-sync'); store.local.get(...) Cannot read property 'set' of undefined
Importing default as 'store' in CommonJS but trying to use store.set(...) directly (store is the module, not local/session).
fixUse store.local.set(...) or import named exports with ESM.
localStorage is not defined (ReferenceError)
Running in Node.js environment where localStorage is not available.
fixUse a polyfill or only use in browser context. superstore-sync relies on window.localStorage.
Audit
Dependencies
No dependency data recorded yet.