Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
web-storage-manager
Advanced tools
Web utility storage manager to handle save, update and data purge
npm install web-storage-manager --save
import Storage from 'web-storage-manager';
// update item on key path of previously saved data
const keyPaths = [ 'targetKeyOnParent', 'collection', 'targetObject', 'changethis']
const keyPaths2 = [ 'targetKeyOnParent', 'collection', 'targetObject', 'changethis2']
Storage.updateItemInItem('test-sample-parent-key', keyPaths, valueInObj, 'id')
Storage.updateItemInItem('test-sample-parent-key', keyPaths2, valueInObj)
// append item
Storage.appendItem('test-sample', { new_item : { desc: 'new test item' } })
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Storage from 'web-storage-manager';
class App extends Component {
componentWillMount() {
// updateItemInItem example
const testItems = [
{
id: 1,
value: '777',
description: 'test item 1'
}, {
id: 2,
value: '888',
description: 'test item 2'
}, {
id: 3,
value: '999',
description: 'test item 3'
}
]
const testOjb = {
name: 'Object',
value: 'target of change',
description: 'test item for object type'
}
const tObj = {
'changethis': testItems, // key of this
'changethis2': testOjb // key of this
}
let collection = {
name: 'The data where our target object was saved',
'targetObject': tObj // key of this
}
let collectionInfo = {
description: 'just another layer for testing',
'collection': collection // key of this
}
let parentItem = {
name: 'parent item',
description: 'test object',
'targetKeyOnParent': collectionInfo // key of this
}
Storage.setItem('test-sample', parentItem);
Storage.setItem('test-sample-for-compare', parentItem);
const valueInObj = {
id: 2,
value: '010',
description: 'test item 101'
}
const keyPaths = [ 'targetKeyOnParent', 'collection', 'targetObject', 'changethis']
const keyPaths2 = [ 'targetKeyOnParent', 'collection', 'targetObject', 'changethis2']
Storage.updateItemInItem('test-sample', keyPaths, valueInObj, 'id')
Storage.updateItemInItem('test-sample', keyPaths2, valueInObj)
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
}
export default App;
storage() // returns window.localStorage
setItem(key, value)
setMultiple(items)
appendItem(key, value)
updateItemInItem(parentKey, childKeys, value, attrCompare)
getItem(key)
getMultiple(keys)
removeItem(key)
removeMultiple(keys) [ 'key1', 'key2' ]
purge() // remove all saved data under active domain
We would love for you to contribute to Web Storage Manager
. See the LICENSE file for more info.
This project was inpired by 'react-persist' that was discontinued.
AutoCompleteTextField is available under the MIT license. See the LICENSE file for more info.
FAQs
Web utility storage manager for handling data encryption, save and persist, update and data purge in your local and session storage
The npm package web-storage-manager receives a total of 4 weekly downloads. As such, web-storage-manager popularity was classified as not popular.
We found that web-storage-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.