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

angular-storage

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-storage - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

24

dist/angular-storage.js

@@ -14,3 +14,3 @@ (function() {

angular.module('angular-storage.internalStore', ['angular-storage.storage'])
.factory('InternalStore', ["storage", function(storage) {
.factory('InternalStore', ["storage", "$log", function(storage, $log) {

@@ -29,3 +29,3 @@ function InternalStore(namespace, delimiter) {

}
}
};

@@ -40,2 +40,3 @@

InternalStore.prototype.get = function(name) {
var obj = null;
if (name in this.inMemoryCache) {

@@ -45,4 +46,15 @@ return this.inMemoryCache[name];

var saved = storage.get(this.getNamespacedKey(name));
var obj = saved ? JSON.parse(saved) : null;
this.inMemoryCache[name] = obj;
try {
if (typeof saved ==="undefined" || saved === "undefined") {
obj = undefined;
} else {
obj = JSON.parse(saved);
}
this.inMemoryCache[name] = obj;
} catch(e) {
$log.error("Error parsing saved value", e);
this.remove(name);
}
return obj;

@@ -54,3 +66,3 @@ };

storage.remove(this.getNamespacedKey(name));
}
};

@@ -64,3 +76,3 @@ return InternalStore;

angular.module('angular-storage.storage', [])
.service('storage', ["$window", function($window) {
.service('storage', ["$window", "$injector", function($window, $injector) {
if ($window.localStorage) {

@@ -67,0 +79,0 @@ this.set = function(what, value) {

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

!function(){angular.module("angular-storage",["angular-storage.store"]),angular.module("angular-storage.internalStore",["angular-storage.storage"]).factory("InternalStore",["storage",function(e){function t(e,t){this.namespace=e||null,this.delimiter=t||".",this.inMemoryCache={}}return t.prototype.getNamespacedKey=function(e){return this.namespace?[this.namespace,e].join(this.delimiter):e},t.prototype.set=function(t,r){this.inMemoryCache[t]=r,e.set(this.getNamespacedKey(t),JSON.stringify(r))},t.prototype.get=function(t){if(t in this.inMemoryCache)return this.inMemoryCache[t];var r=e.get(this.getNamespacedKey(t)),n=r?JSON.parse(r):null;return this.inMemoryCache[t]=n,n},t.prototype.remove=function(t){this.inMemoryCache[t]=null,e.remove(this.getNamespacedKey(t))},t}]),angular.module("angular-storage.storage",[]).service("storage",["$window",function(e){if(e.localStorage)this.set=function(t,r){return e.localStorage.setItem(t,r)},this.get=function(t){return e.localStorage.getItem(t)},this.remove=function(t){return e.localStorage.removeItem(t)};else{var t=$injector.get("$cookieStore");this.set=function(e,r){return t.put(e,r)},this.get=function(e){return t.get(e)},this.remove=function(e){return t.remove(e)}}}]),angular.module("angular-storage.store",["angular-storage.internalStore"]).factory("store",["InternalStore",function(e){var t=new e;return t.getNamespacedStore=function(t,r){return new e(t,r)},t}])}();
!function(){angular.module("angular-storage",["angular-storage.store"]),angular.module("angular-storage.internalStore",["angular-storage.storage"]).factory("InternalStore",["storage","$log",function(e,t){function r(e,t){this.namespace=e||null,this.delimiter=t||".",this.inMemoryCache={}}return r.prototype.getNamespacedKey=function(e){return this.namespace?[this.namespace,e].join(this.delimiter):e},r.prototype.set=function(t,r){this.inMemoryCache[t]=r,e.set(this.getNamespacedKey(t),JSON.stringify(r))},r.prototype.get=function(r){var n=null;if(r in this.inMemoryCache)return this.inMemoryCache[r];var o=e.get(this.getNamespacedKey(r));try{n="undefined"==typeof o||"undefined"===o?void 0:JSON.parse(o),this.inMemoryCache[r]=n}catch(a){t.error("Error parsing saved value",a),this.remove(r)}return n},r.prototype.remove=function(t){this.inMemoryCache[t]=null,e.remove(this.getNamespacedKey(t))},r}]),angular.module("angular-storage.storage",[]).service("storage",["$window","$injector",function(e,t){if(e.localStorage)this.set=function(t,r){return e.localStorage.setItem(t,r)},this.get=function(t){return e.localStorage.getItem(t)},this.remove=function(t){return e.localStorage.removeItem(t)};else{var r=t.get("$cookieStore");this.set=function(e,t){return r.put(e,t)},this.get=function(e){return r.get(e)},this.remove=function(e){return r.remove(e)}}}]),angular.module("angular-storage.store",["angular-storage.internalStore"]).factory("store",["InternalStore",function(e){var t=new e;return t.getNamespacedStore=function(t,r){return new e(t,r)},t}])}();
{
"name": "angular-storage",
"version": "0.0.8",
"version": "0.0.9",
"author": {

@@ -5,0 +5,0 @@ "name": "Martin Gontovnikas",

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