🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

devel-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devel-localstorage - npm Package Compare versions

Comparing version

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",