Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-localstorage - npm Package Compare versions

Comparing version 1.3.1 to 2.0.0

azure-pipelines.yml

12

LocalStorage.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.12.7
(function() {

@@ -52,2 +52,3 @@ var JSONStorage, KEY_FOR_EMPTY_STRING, LocalStorage, MetaKey, QUOTA_EXCEEDED_ERR, StorageEvent, _emptyDirectory, _escapeKey, _rm, createMap, events, fs, path, writeSync,

this.message = message != null ? message : 'Unknown error.';
QUOTA_EXCEEDED_ERR.__super__.constructor.call(this);
if (Error.captureStackTrace != null) {

@@ -110,2 +111,3 @@ Error.captureStackTrace(this, this.constructor);

this.quota = quota != null ? quota : 5 * 1024 * 1024;
LocalStorage.__super__.constructor.call(this);
if (!(this instanceof LocalStorage)) {

@@ -130,3 +132,3 @@ return new LocalStorage(this._location, this.quota);

LocalStorage.prototype._init = function() {
var _MetaKey, _decodedKey, _keys, e, error, error1, i, index, k, len, stat;
var _MetaKey, _decodedKey, _keys, e, i, index, k, len, stat;
try {

@@ -160,4 +162,4 @@ stat = fs.statSync(this._location);

fs.mkdirSync(this._location);
} catch (error1) {
e = error1;
} catch (error) {
e = error;
if (e.code !== "EEXIST") {

@@ -219,3 +221,3 @@ throw e;

LocalStorage.prototype._getStat = function(key) {
var error, filename;
var filename;
key = _escapeKey(key);

@@ -222,0 +224,0 @@ filename = path.join(this._location, encodeURIComponent(key));

{
"name": "node-localstorage",
"version": "1.3.1",
"version": "2.0.0",
"main": "./LocalStorage",

@@ -25,17 +25,11 @@ "description": "A drop-in substitute for the browser native localStorage API that runs on node.js.",

"devDependencies": {
"coffee-script": "^1.10.0",
"lodash": "^3.10.1",
"nodeunit": "~0.9.0"
"coffeescript": "^1.12.7",
"coffeetape": "^2.0.0",
"lodash": "^4.17.15"
},
"scripts": {
"test": "cake test",
"docompile": "cake compile",
"prepublish": "cake compile"
"test": "coffeetape test/*.coffee",
"prepare": "cake compile"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"license": "MIT",
"dependencies": {

@@ -42,0 +36,0 @@ "write-file-atomic": "^1.1.4"

[![build status](https://secure.travis-ci.org/lmaccherone/node-localstorage.png)](http://travis-ci.org/lmaccherone/node-localstorage)
[![bitHound Score](https://www.bithound.io/github/lmaccherone/node-localstorage/badges/score.svg)](https://www.bithound.io/github/lmaccherone/node-localstorage)
# node-localstorage #

@@ -43,12 +42,25 @@

unless localStorage?
{LocalStorage} = require('../') # require('node-localstorage') for you
localStorage = new LocalStorage('./scratch')
```coffee
unless localStorage?
{LocalStorage} = require('../') # require('node-localstorage') for you
localStorage = new LocalStorage('./scratch')
localStorage.setItem('myFirstKey', 'myFirstValue')
console.log(localStorage.getItem('myFirstKey'))
# myFirstValue
localStorage._deleteLocation() # cleans up ./scratch created during doctest
localStorage.setItem('myFirstKey', 'myFirstValue')
console.log(localStorage.getItem('myFirstKey'))
# myFirstValue
localStorage._deleteLocation() # cleans up ./scratch created during doctest
```
### ReactJs ###
Open or create `src/setupTests.js` and add these two lines:
``` JavaScript
// /src/setupTests.js
import { LocalStorage } from "node-localstorage";
global.localStorage = new LocalStorage('./scratch');
```
### JavaScript ###

@@ -66,2 +78,10 @@

### Polyfill on Node.js ###
Polyfil your node.js environment with this as the global localStorage when launching your own code
```sh
node -r node-localstorage/register my-code.js
```
## Installation ##

@@ -73,2 +93,3 @@

* 2.0.0 - 2019-10-17 - Updated all the depdendencies, added ability to register as polyfill (thanks @dy)
* 1.3.1 - 2018-03-19 - Resolves issue #32 (thanks, plamens)

@@ -101,18 +122,1 @@ * 1.3.0 - 2016-04-09 - **Possibly backward breaking if you were using experimental syntax** Reverted experimental

* 0.1.0 - 2012-10-29 - Original version
## MIT License ##
Copyright (c) 2011, 2012, Lawrence S. Maccherone, Jr.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc