Skip to content

Commit

Permalink
Prep for 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bevacqua committed Apr 22, 2019
1 parent 2046616 commit 48b8088
Show file tree
Hide file tree
Showing 6 changed files with 1,571 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelog.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2.0.0

- Added relaxed JSON parsing that returns `null` when `undefined`, raw input for non-JSON data
- Added `.backend` method
- Added TypeScript typings
- Improved documentation

# 1.4.1

Fix a bug where `local-storage` would throw in IE when using the `file://` protocol
Expand Down
5 changes: 4 additions & 1 deletion local-storage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var stub = require('./stub');
var parse = require('./parse');
var tracking = require('./tracking');
var ls = 'localStorage' in global && global.localStorage ? global.localStorage : stub;

Expand All @@ -12,7 +13,9 @@ function accessor (key, value) {
}

function get (key) {
return JSON.parse(ls.getItem(key));
const raw = ls.getItem(key);
const parsed = parse(raw);
return parsed;
}

function set (key, value) {
Expand Down
Loading

0 comments on commit 48b8088

Please sign in to comment.