Socket
Socket
Sign inDemoInstall

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 2.0.0 to 2.1.0

.nyc_output/6381771d-6c94-4831-93d1-b36df6028f80.json

25

LocalStorage.js

@@ -108,2 +108,3 @@ // Generated by CoffeeScript 1.12.7

function LocalStorage(_location, quota) {
var handler;
this._location = _location;

@@ -126,2 +127,26 @@ this.quota = quota != null ? quota : 5 * 1024 * 1024;

this._QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR;
if (typeof Proxy !== "undefined" && Proxy !== null) {
handler = {
set: (function(_this) {
return function(receiver, key, value) {
if (_this[key] != null) {
return _this[key] = value;
} else {
return _this.setItem(key, value);
}
};
})(this),
get: (function(_this) {
return function(receiver, key) {
if (_this[key] != null) {
return _this[key];
} else {
return _this.getItem(key);
}
};
})(this)
};
instanceMap[this._location] = new Proxy(this, handler);
return instanceMap[this._location];
}
instanceMap[this._location] = this;

@@ -128,0 +153,0 @@ return instanceMap[this._location];

14

package.json
{
"name": "node-localstorage",
"version": "2.0.0",
"version": "2.1.0",
"main": "./LocalStorage",

@@ -27,7 +27,13 @@ "description": "A drop-in substitute for the browser native localStorage API that runs on node.js.",

"coffeetape": "^2.0.0",
"lodash": "^4.17.15"
"lodash": "^4.17.15",
"nyc": "^14.1.1",
"tap-nyc": "^1.0.3",
"tap-spec": "^5.0.0"
},
"scripts": {
"test": "coffeetape test/*.coffee",
"prepare": "cake compile"
"test": "npm run build; coffeetape test/*.coffee | tap-spec",
"coverage": "npm run build; nyc --reporter=lcov coffeetape test/*.coffee | tap-nyc",
"coverage:report": "nyc report --reporter=text-summary",
"build": "coffee -c *.coffee",
"prepare": "coffee -c *.coffee"
},

@@ -34,0 +40,0 @@ "license": "MIT",

@@ -20,15 +20,8 @@ [![build status](https://secure.travis-ci.org/lmaccherone/node-localstorage.png)](http://travis-ci.org/lmaccherone/node-localstorage)

* Supports the setting of a quota (default 5MB)
* Events. This doesn't exactly follow the spec which states that events are NOT supposed to be emitted to the browser window
that took the action that triggered the event in the first place. They are only to be emitted to listeners in
other browser windows. Early browser implementations actually did it this way and we don't really have the equivalent
of a browser window in node.js, so we choose to implement them in the current process. We did, however, include the pid
information in place of the window uri, so if we later wanted to say think of other node.js processes accessing
the same file system, we could actually implement it correctly. That would involve file watchers though and was more
than we wanted to implement for now. Maybe later.
* (temporarily removed) Associative array `localStorage['myKey'] = 'myValue'` and dot property `localStorage.myKey = 'myValue'`
syntax. This only works if you use the --harmony-proxies flag. It senses the existence of the Proxy object in the root
scope. If you have added your own Proxy object, then you could have a problem. Another potential risk is around
the "private", underscore preceded methods and properties. I had to reserve those in addition to the standard ones,
so you won't be able to use keys that overlap with those underscore preceded properties and methods in a harmony-proxies
environment.
* Events. This doesn't exactly follow the spec which states that events are NOT supposed to be emitted to the
browser window that took the action that triggered the event in the first place. They are only to be emitted to listeners in other browser windows. Early browser implementations actually did it this way and we don't really have the equivalent of a browser window in node.js, so we choose to implement them in the current process.
* Associative array `localStorage['myKey'] = 'myValue'` and dot property `localStorage.myKey = 'myValue'`
syntax. If you are in an ES6 supported environment. Limitations:
* You won't be able to use keys that collide with my "private" (starts with "_" like "_init") properties and
methods.

@@ -92,3 +85,4 @@ ## Credits ##

* 2.0.0 - 2019-10-17 - Updated all the depdendencies, added ability to register as polyfill (thanks @dy)
* 2.1.0 - 2019-11-17 - Added back dot-property and associative-array syntax using ES6 Proxy
* 2.0.0 - 2019-11-17 - Updated all the depdendencies, added ability to register as polyfill (thanks @dy)
* 1.3.1 - 2018-03-19 - Resolves issue #32 (thanks, plamens)

@@ -95,0 +89,0 @@ * 1.3.0 - 2016-04-09 - **Possibly backward breaking if you were using experimental syntax** Reverted experimental

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