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.13 to 1.0.14

68

index.js

@@ -1,41 +0,29 @@

/**
* @Author: Andreee Ray <develdoe>
* @Date: 2017-04-11T14:26:37+02:00
* @Email: me@andreeray.se
* @Filename: index.js
* @Last modified by: develdoe
* @Last modified time: 2017-04-19T12:54:52+02:00
*/
exports.DevelLocalStorage = {
/**
* Takes an array and transforms it to a string for localStorage
* and stores is as 'store'
* @param {Array} data
*/
set: function(store, data) {
if (Array.isArray(data)) {
localStorage.setItem(store, JSON.stringify(data))
return data
}
},
/**
* Gets the 'store in localStorage and parses it back to array (JSON)
* @return {Array} returns the store as an array if it exist otherwise
* returns an empy array
*/
get: function(store) {
var stringArray = localStorage.getItem(store)
var array = []
try {
array = JSON.parse(stringArray)
} catch (e) {
console.log(e)
}
return Array.isArray(array) ? array : []
}
let DevelLocalStorage = {
/**
* Takes an array and transforms it to a string for localStorage
* and stores is as 'store'
* @param {Array} data
*/
set: function(store, data) {
if (Array.isArray(data)) {
localStorage.setItem(store, JSON.stringify(data))
return data
}
},
/**
* Gets the 'store in localStorage and parses it back to array (JSON)
* @return {Array} returns the store as an array if it exist otherwise
* returns an empy array
*/
get: function(store) {
var stringArray = localStorage.getItem(store)
var array = []
try {
array = JSON.parse(stringArray)
} catch (e) {
console.log(e)
}
return Array.isArray(array) ? array : []
}
}
export default DevelLocalStorage
}
{
"name": "devel-localstorage",
"version": "1.0.13",
"version": "1.0.14",
"description": "A small library providing an API for localStorage",

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

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