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

angular-marshall.storage

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-marshall.storage - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

2

package.json
{
"name": "angular-marshall.storage",
"version": "0.1.3",
"version": "0.2.0",
"description": "A simple localStorage service for angular.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,2 +22,22 @@ # Angular LocalStorage Service

.module('example', ['marshall.storage'])
.run(function () {
var storage = storageService('example.');
// Number
storage.set('foobar', 123);
console.log(storage.get('foobar')); // '123' (String)
console.log(storage.get('foobar', Number)); // 123 (Number)
// JSON
storage.set('foobar', JSON.stringify({ one: 'two' }));
console.log(storage.get('foobar')); // '{"one":"two"}' (String)
console.log(storage.get('foobar', JSON.parse)); // { one: 'two' } (Object)
});
```
```js
angular
.module('example', ['marshall.storage'])
.run(function (storageService) {

@@ -24,0 +44,0 @@ var storage = storageService('example.');

@@ -60,6 +60,11 @@ /*!

* @param {String} key
* @param {Function} [parser]
* @returns {String|null}
*/
proto.get = function (key) {
return priv.safeStorage.call(this, 'getItem', this.prefix + key);
proto.get = function (key, parser) {
if (typeof parser !== 'function') {
parser = function (value) { return value; };
}
return parser(priv.safeStorage.call(this, 'getItem', this.prefix + key));
};

@@ -66,0 +71,0 @@

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