localstorage-memory
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -34,4 +34,7 @@ (function(root) { | ||
} else { | ||
if (!(cache.hasOwnProperty(key))) { | ||
localStorageMemory.length++; | ||
} | ||
cache[key] = '' + value; | ||
localStorageMemory.length++; | ||
} | ||
@@ -48,4 +51,6 @@ }; | ||
localStorageMemory.removeItem = function(key) { | ||
delete cache[key]; | ||
localStorageMemory.length--; | ||
if (cache.hasOwnProperty(key)) { | ||
delete cache[key]; | ||
localStorageMemory.length--; | ||
} | ||
}; | ||
@@ -80,3 +85,1 @@ | ||
})(this); | ||
{ | ||
"name": "localstorage-memory", | ||
"version": "1.0.1", | ||
"description": "localStorage-compatible API, but only stored in memory", | ||
@@ -16,7 +15,8 @@ "main": "lib/localstorage-memory.js", | ||
"docs": "doxx --source lib/ --target docs/ --template docs/template.jade", | ||
"deploy": "gh-pages-deploy " | ||
"deploy": "gh-pages-deploy ", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/gr2m/localstorage-memory" | ||
"url": "https://github.com/gr2m/localstorage-memory" | ||
}, | ||
@@ -44,7 +44,9 @@ "keywords": [ | ||
"sauce-connect-launcher": "^0.9.3", | ||
"wd": "^0.3.11" | ||
"wd": "^0.3.11", | ||
"semantic-release": "^6.0.3" | ||
}, | ||
"gh-pages-deploy": { | ||
"staticpath": "docs" | ||
} | ||
} | ||
}, | ||
"version": "1.0.2" | ||
} |
@@ -13,3 +13,3 @@ # localstorage-memory | ||
## Downlaod or Installation | ||
## Download or Installation | ||
@@ -16,0 +16,0 @@ - Download [localstorage-memory.js](https://raw.githubusercontent.com/gr2m/localstorage-memory/master/lib/localstorage-memory.js) |
@@ -63,2 +63,14 @@ /* global localStorageMemory, beforeEach, describe, it, expect */ | ||
}); | ||
describe('localStorageMemory.length', function () { | ||
it ('duplicate puts don\'t increase length', function () { | ||
localStorageMemory.setItem('123', 'foo'); | ||
localStorageMemory.setItem('123', 'foo'); | ||
expect(localStorageMemory.length).to.be(1); | ||
}); | ||
it ('remove non-existent item doesn\'t decrease length', function () { | ||
localStorageMemory.setItem('123', 'foo'); | ||
localStorageMemory.removeItem('abc'); | ||
expect(localStorageMemory.length).to.be(1); | ||
}); | ||
}); | ||
}); |
@@ -42,11 +42,2 @@ /* global mocha: true */ | ||
function loadNext() { | ||
if (scriptsToLoad.length) { | ||
var script = scriptsToLoad.shift(); | ||
asyncLoadScript(script, loadNext); | ||
} else { | ||
onReady(); | ||
} | ||
} | ||
function onReady() { | ||
@@ -81,2 +72,11 @@ var runner = mocha.run(); | ||
function loadNext() { | ||
if (scriptsToLoad.length) { | ||
var script = scriptsToLoad.shift(); | ||
asyncLoadScript(script, loadNext); | ||
} else { | ||
onReady(); | ||
} | ||
} | ||
loadNext(); | ||
@@ -83,0 +83,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59113
392
11