Socket
Socket
Sign inDemoInstall

devel-localstorage

Package Overview
Dependencies
0
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.9 to 1.0.11

40

index.js

@@ -12,3 +12,3 @@ /**

let localStorage = {
let localStorage = {
/**

@@ -19,3 +19,3 @@ * Takes an array and transforms it to a string for localStorage

*/
set: function (store, data) {
set: function(store, data) {
if (Array.isArray(data)) {

@@ -31,35 +31,15 @@ localStorage.setItem(store, JSON.stringify(data))

*/
get: function (store) {
get: function(store) {
var stringArray = localStorage.getItem(store)
var array = []
try { array = JSON.parse(stringArray) } catch (e) {}
try {
array = JSON.parse(stringArray)
} catch (e) {
console.log(e)
}
return Array.isArray(array) ? array : []
}
//
// filter: function (store, query, callback) {
// // TODO : filter function and use callback pattern
// // if (response) callback(undefined, response.response)
// // else callback('That command does not exist! To list basic commands execute <b>commands</b> (or <b>cmd</b>) in the cmd field below.')
// }
}
export default localStorage
// filterTodos: function (todos, showCompleted, search) {
//
// var filteredTodos = todos.filter((todo) => {
// return !todo.completed || showCompleted
// })
//
// filteredTodos = filteredTodos.filter((todo) => {
// var text = todo.text.toLowerCase()
// return search.length === 0 || todo.text.indexOf(search) > - 1
// })
//
// filteredTodos.sort((a,b) => {
// if (!a.completed && b.completed) return - 1
// else if (a.completed && !b.completed) return 1
// else return 0
// })
//
// return filteredTodos
// }
export default localStorage
{
"name": "devel-localstorage",
"version": "1.0.9",
"version": "1.0.11",
"description": "A small library providing an API for localStorage",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,6 +26,6 @@ <!--

// set
var res = localstorage.set('store',['devel','doe'])
var res = localStorage.set('store',['devel','doe'])
// get
var res = localstorage.get('store')
var res = localStorage.get('store')
```

@@ -32,0 +32,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc