MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / addToLocalStorage

Function addToLocalStorage

assets/js/localstorage.js:141–146  ·  view source on GitHub ↗
(id, value)

Source from the content-addressed store, hash-verified

139
140// add to local storage
141function addToLocalStorage(id, value) {
142 const grocery = { id, value };
143 let items = getLocalStorage();
144 items.push(grocery);
145 localStorage.setItem("list", JSON.stringify(items));
146}
147
148function getLocalStorage() {
149 return localStorage.getItem("list")

Callers 1

addItemFunction · 0.85

Calls 2

getLocalStorageFunction · 0.85
stringifyMethod · 0.80

Tested by

no test coverage detected