
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
storage-sync-lite
Advanced tools
Easily store objects or any type of data to localStorage or sessionStorage.
Easily store objects or any type of data to localStorage or sessionStorage.
Why this? When you store a JSON/object to localStorage or sessionStorage you need to stringify the data. After storing a number in localStorage when you will read it, you will get the number as a string. But storage-sync-lite allows storing and retrieving data without changing the type. If you store an object when you will read, it will return the object.
npm i storage-sync-lite
Set and get local:
import { setLocal, getLocal } from 'storage-sync-lite'
// Set/Store
setLocal('user', {
email: 'user@example.com',
age: 25
})
// Get
let user = getLocal('user')
console.log(user) // Returns: { email: 'user@example.com', age: 25 }
Change/update properties from local:
import { changeLocal, getLocal } from 'storage-sync-lite'
// Change/update properties
changeLocal('user', {
name: 'Mr. User'
})
console.log(getLocal('user')) // Returns: { email: 'user@example.com', age: 25, name: 'Mr. User' }
Delete data from local:
import { deleteLocal, clearLocal } from 'storage-sync-lite'
// Delete single data from local
deleteLocal('user')
// Clear / delete all data from local
clearLocal()
Set and get session:
import { setSession, getSession } from 'storage-sync-lite'
// Set/Store
setSession('user', {
email: 'user@example.com',
age: 25
})
// Get
let user = getSession('user')
console.log(user) // Returns: { email: 'user@example.com', age: 25 }
Change/update properties from session:
import { changeSession, getSession } from 'storage-sync-lite'
// Change/update properties
changeSession('user', {
name: 'Mr. User'
})
console.log(getSession('user')) // Returns: { email: 'user@example.com', age: 25, name: 'Mr. User' }
Delete data from session:
import { deleteSession, clearSession } from 'index'
// Delete single data from session
deleteSession('user')
// Clear / delete all data from session
clearSession()
storage-sync-lite is licensed under the MIT license.
@SheikhAminul |
FAQs
Easily store objects or any type of data to localStorage or sessionStorage.
The npm package storage-sync-lite receives a total of 13 weekly downloads. As such, storage-sync-lite popularity was classified as not popular.
We found that storage-sync-lite 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
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.