Registry / storage / name-storage

name-storage

JSON →
library1.3.0jsnpmunverified

A key-value storage tool similar to sessionStorage but capable of cross-domain data storage and transfer within the same window. It uses window.name to store data, with a lifespan tied to the window session. Version 1.3.0 is the latest stable release, though the project appears to be in maintenance mode with no recent updates. Key differentiators include cross-domain support without server-side proxies and a simple API modeled after Web Storage. It enforces usage conventions to avoid direct window.name manipulation and minimize data conflicts.

npm install name-storage
INSTALL
IMPORT
SIG · NAME-STORAGE
N
name-storage
storagejavascriptv1.3.0
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.

nameStorage
import nameStorage from 'name-storage'
import { nameStorage } from 'name-storage'
Default export only; named import will fail.
setItem
nameStorage.setItem('key', 'value')
nameStorage.setItem('key', {})
Value must be a string; objects are not automatically serialized.
getItem
nameStorage.getItem('key')
nameStorage['key']
Direct property access is not supported.
removeItem
nameStorage.removeItem('key')
delete nameStorage['key']
Use the dedicated method to ensure proper cleanup.
clear
nameStorage.clear()
window.name = ''
Directly clearing window.name may corrupt data from other modules.

Demonstrates basic usage: import, set, get, remove, and clear operations with nameStorage.

// Install: npm install name-storage import nameStorage from 'name-storage'; // Store a value nameStorage.setItem('name', 'Alice'); // Retrieve the value const storedName = nameStorage.getItem('name'); console.log(storedName); // 'Alice' // Remove a value nameStorage.removeItem('name'); // Clear all stored data nameStorage.clear(); // Note: Values must be strings; use JSON.stringify/parse for objects.
Debug
Known issues
gotchaValue must be a string. Non-string values are not automatically serialized.
fix
Use JSON.stringify before setItem and JSON.parse after getItem for objects.
affects: >=0.0.0
gotchaDirect manipulation of window.name may corrupt data stored by nameStorage or other modules.
fix
Always use nameStorage API (setItem, getItem, removeItem, clear) instead of directly accessing window.name.
affects: >=0.0.0
gotchanameStorage data is limited to the current window session; it persists across page navigations within the same window but not across tabs.
fix
Use sessionStorage, localStorage, or cookies if longer persistence or cross-tab sharing is needed.
affects: >=0.0.0
deprecatedThe package is no longer actively maintained and may have unresolved issues.
fix
Consider migrating to modern alternatives like sessionStorage or cross-domain storage solutions with postMessage.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: nameStorage.getItem is not a function
Incorrect import (named instead of default) or module not loaded.
fix
Use default import: import nameStorage from 'name-storage';
ReferenceError: nameStorage is not defined
The name-storage module was not imported or bundled.
fix
Ensure the import statement is present and the package is installed.
Uncaught Error: nameStorage data corrupted
Direct modification of window.name by other scripts.
fix
Avoid direct window.name assignment; coordinate with other code using the same window.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
name-storage — npm install name-storage · libregistry