localstorage-fifo
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -92,6 +92,13 @@ var classCallCheck = function (instance, Constructor) { | ||
this.checkLocalStorage(options.shim); | ||
this.data = JSON.parse(this.LS.getItem(this.namespace)) || { | ||
this.data = { | ||
keys: [], | ||
items: {} | ||
}; | ||
var dataFromStorage = JSON.parse(this.LS.getItem(this.namespace)); | ||
if (dataFromStorage && Object.prototype.hasOwnProperty.call(dataFromStorage, 'keys') && Object.prototype.hasOwnProperty.call(dataFromStorage, 'items')) { | ||
this.data = dataFromStorage; | ||
} else { | ||
this.console('error', 'Namespace Collision, or, data is not in the correct format.'); | ||
} | ||
} | ||
@@ -98,0 +105,0 @@ |
{ | ||
"name": "localstorage-fifo", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "JavaScript library for interacting with localStorage safely.", | ||
@@ -26,22 +26,22 @@ "author": "Matthew Callis <matthew.callis@gmail.com>", | ||
"devDependencies": { | ||
"ava": "^0.17.0", | ||
"babel-cli": "^6.22.2", | ||
"ava": "^0.18.2", | ||
"babel-cli": "^6.23.0", | ||
"babel-plugin-espower": "^2.3.2", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-istanbul": "^3.1.2", | ||
"babel-plugin-istanbul": "^4.0.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babel-preset-es2015-rollup": "^3.0.0", | ||
"babel-preset-es2016": "^6.22.0", | ||
"babel-register": "^6.22.0", | ||
"browser-env": "^2.0.19", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"coveralls": "^2.11.15", | ||
"eslint": "^3.14.1", | ||
"eslint-config-airbnb": "^14.0.0", | ||
"babel-register": "^6.23.0", | ||
"browser-env": "^2.0.21", | ||
"codeclimate-test-reporter": "^0.4.1", | ||
"coveralls": "^2.11.16", | ||
"eslint": "^3.16.0", | ||
"eslint-config-airbnb": "^14.1.0", | ||
"eslint-loader": "^1.6.1", | ||
"eslint-plugin-ava": "^4.0.1", | ||
"eslint-plugin-ava": "^4.2.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^3.0.2", | ||
"eslint-plugin-jsx-a11y": "^4.0.0", | ||
"eslint-plugin-no-inferred-method-name": "^1.0.2", | ||
"eslint-plugin-react": "^6.9.0", | ||
"eslint-plugin-react": "^6.10.0", | ||
"eslint-plugin-xss": "^0.1.8", | ||
@@ -64,3 +64,3 @@ "npm-bump": "^0.0.20", | ||
"scripts": { | ||
"lint": "eslint src", | ||
"lint": "eslint --quiet --color src/", | ||
"local-web-server": "ruby -run -ehttpd . -p12345", | ||
@@ -67,0 +67,0 @@ "make": "node rollup.config.js", |
# [Fifo](https://github.com/MatthewCallis/fifo) | ||
[![Build Status](https://travis-ci.org/MatthewCallis/fifo.svg)](https://travis-ci.org/MatthewCallis/fifo) | ||
[![Dependency Status](https://david-dm.org/MatthewCallis/fifo.svg)](https://david-dm.org/MatthewCallis/fifo) | ||
[![devDependency Status](https://david-dm.org/MatthewCallis/fifo/dev-status.svg?style=flat)](https://david-dm.org/MatthewCallis/fifo#info=devDependencies) | ||
[![Test Coverage](https://codeclimate.com/github/MatthewCallis/fifo/badges/coverage.svg)](https://codeclimate.com/github/MatthewCallis/fifo/coverage) | ||
@@ -7,0 +5,0 @@ [![Coverage Status](https://coveralls.io/repos/github/MatthewCallis/fifo/badge.svg?branch=master)](https://coveralls.io/github/MatthewCallis/fifo?branch=master) |
@@ -19,6 +19,13 @@ import LocalStorage from './localStorage'; | ||
this.checkLocalStorage(options.shim); | ||
this.data = JSON.parse(this.LS.getItem(this.namespace)) || { | ||
this.data = { | ||
keys: [], | ||
items: {}, | ||
}; | ||
const dataFromStorage = JSON.parse(this.LS.getItem(this.namespace)); | ||
if (dataFromStorage && Object.prototype.hasOwnProperty.call(dataFromStorage, 'keys') && Object.prototype.hasOwnProperty.call(dataFromStorage, 'items')) { | ||
this.data = dataFromStorage; | ||
} else { | ||
this.console('error', 'Namespace Collision, or, data is not in the correct format.'); | ||
} | ||
} | ||
@@ -25,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
943
36213
22
71