Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "storage2", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "html5 storage interface for node and browser", | ||
"main": "index.js", | ||
"main": "./lib/node.js", | ||
"scripts": { | ||
@@ -10,3 +10,3 @@ "test": "./node_modules/tape/bin/tape test.js" | ||
"browser": { | ||
"index.js": "client.js" | ||
"./lib/node.js": "./lib/client.js" | ||
}, | ||
@@ -16,2 +16,3 @@ "author": "Wang Zuo", | ||
"devDependencies": { | ||
"istanbul": "^0.3.17", | ||
"tape": "^4.0.0" | ||
@@ -21,2 +22,3 @@ }, | ||
"localStorage", | ||
"polyfill", | ||
"sessionStorage", | ||
@@ -23,0 +25,0 @@ "storage" |
# storage2 | ||
[](https://travis-ci.org/pqx/require-storage) | ||
[](https://travis-ci.org/pqx/storage2) [](http://codecov.io/github/pqx/storage2?branch=master) | ||
@@ -19,2 +19,5 @@ One single html5 storage interface for node and browser (`browserify`) | ||
``` | ||
For safari private mode, `localStorage` and `sessionStorage` will still be available but storage usage will cause an exception. `localStorage = require('storage2').localStorage` is not recommended and a different variable name like `ls` should always be used. | ||
### API | ||
@@ -21,0 +24,0 @@ [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Storage) |
var test = require('tape'); | ||
var ls = require('./').localStorage; | ||
var ss = require('./').sessionStorage; | ||
var Storage = require('./lib/node'); | ||
var ls = Storage.localStorage; | ||
var ss = Storage.sessionStorage; | ||
test('localStorage', function(t) { | ||
t.plan(6); | ||
t.equal(ls.length, 0); | ||
@@ -15,6 +15,6 @@ ls.setItem('test', '42'); | ||
t.equal(ls.length, 0); | ||
t.end(); | ||
}); | ||
test('sessionStorage', function(t) { | ||
t.plan(6); | ||
t.equal(ss.length, 0); | ||
@@ -28,2 +28,3 @@ ss.setItem('test', '42'); | ||
t.equal(ss.length, 0); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
6904
145
26
2
12