
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@oyvindher/preserve
Advanced tools
A state lib for keeping track of and change localStorage data
npm install @oyvindher/preserve
or with Yarn
yarn add @oyvindher/preserve
preserve(key:string, initialData?: any)
The preserve function gives you 4 methods in return:
get<T>()
Gives the current state of your localstorage item.set<T>(data:T)
Set the current state of your localstorage item.subscribe(callback: (prevData, nextData) => void)
Gives you a callback to listen to current state changesclearItem()
Clears the localStorge itemimport preserve from '@oyvindher/preserve';
// Make an item you want to keep track of.
// The initial state is optional.
const myItem = preserve('myData', 0);
// Get the current data from localStorage key
myItem.get(); // 0
// Update the localStorage data.
myItem.set(1);
// Listen to changes that happens within your localStorage item
myItem.subscribe((prevData, nextData) => {
console.log(prevData); // 0
console.log(nextData); // 1
});
// Clear the item from localStorage
myItem.clearItem();
PreserveLogger is a handy util for development for logging out previous and next state of any given preserved item when it changes.
This is how you would use it:
import preserve, { preserveLogger } from '@oyvindher/preserve';
const myItem = preserve('myItem');
// Pass the item you want to log.
preserveLogger(myItem);
FAQs
A handy localstorage util
We found that @oyvindher/preserve 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.