
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
better-localstorage
Advanced tools
NPM package for interactions with localstorage with JSON-like data.
This module is published through the NPM registry. You can easly install it with the following command:
npm i better-localstorage
This module allow to interact with client's localstorage and store JSON-parsed data, so each entry can contains JSON-like data.
get(key[, options])Get an element from the local storage.
Object - Entry's content if it exists and its content as been parsed.undefined - If the entry doesn't exists.| Name | Type | Facultative | Description |
|---|---|---|---|
key | string | Entry's name | |
options | GetOptions | :white_check_mark: | Getter's options |
RangeError - If key is not provided.TypeError - If the entry's value cannot be parsed as JSON.// { test: { something: true } }
get("test"); // { something: true }
// { test: { something: true } }
get("something"); // undefined
// { test: 1 }
get("test"); // 1
set(key, value)Set an element to the local storage.
undefined.| Name | Facultative | Facultative | Description |
|---|---|---|---|
key | string | Entry's name | |
value | Object | Content to set in the localstorage |
RangeError - If key or value is not provided.TypeError if the value cannot be strigified as JSON.// { test: { something: true } }
set("test", true);
// { test: true }
// { test: { something: true } }
set("something", { hi: "everyone" });
// { test: { something: true }, hi: "everyone" }
exists(key)Check if an entry exists in the local storage.
boolean - true if the entry exists, false otherwise.| Name | Type | Facultative | Description |
|---|---|---|---|
key | string | Entry's name |
RangeError - If key is not provided.// { test: "hi" }
exists("test"); // true
// { test: "hi" }
exists("something"); // false
destroy(key)Remove an entry from the local storage.
boolean - true if the entry has been removed by the function's call, false otherwise.| Name | Type | Facultative | Description |
|---|---|---|---|
key | string | Entry's name |
RangeError - If key is not provided.// { test: "hi", something: "everyone" }
destroy("test"); // true
// { something: "everyone" }
// { test: "hi" }
destroy("something"); // false
// { test: "hi" }
clear()Clear all entries from the local storage.
boolean - true if the entries have been removed by the function's call, false otherwise.// { test: "hi", something: "everyone" }
clear(); // true
// { }
// { }
clear(); // false
// { }
GetOptionsget() options.
| Name | Type | Facultative | Description |
|---|---|---|---|
destroy | boolean | :white_check_mark: | If true, will destroy the entry after calling this function (even if an error occured) |
destroyOnError | boolean | :white_check_mark: | If true, will destroy the entry only if an error occured |
Feel free to open an issue if you want to report bugs or discuss about suggestions!
FAQs
Asynchronous key-value pair local storage with indexed-db.
We found that better-localstorage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.