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

web-storage-manager

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-storage-manager - npm Package Compare versions

Comparing version 1.0.23 to 1.0.24

40

lib/web-storage-manager.js

@@ -46,3 +46,3 @@ require("core-js/modules/es7.symbol.async-iterator");

try {
const encoded = this.encode(value);
const encoded = exports.encode(value);
storage.setItem(key, encoded);

@@ -88,3 +88,3 @@ return true;

for (const i of items) {
const encoded = this.encode(i.value);
const encoded = exports.encode(i.value);
storage.setItem(i.key, encoded);

@@ -109,17 +109,17 @@ }

const data = storage.getItem(key);
const r = this.isDataEncoded(data);
const r = exports.isDataEncoded(data);
let oldData = {};
if (r === 1) {
collection = exports.decode(data);
} else if (r === 0) {
collection = JSON.parse(data);
} else if (r === 0) {
collection = this.decode(data);
}
const newData = this.combineObject(value, oldData);
const newData = exports.combineObject(value, oldData);
if (r === 1) {
return this.setEncodeItem(key, newData);
return exports.setEncodeItem(key, newData);
} else if (r === 0) {
return this.setItem(key, newData);
return exports.setItem(key, newData);
}

@@ -178,8 +178,8 @@ } catch (error) {

const data = storage.getItem(parentKey);
const r = this.isDataEncoded(data);
const r = exports.isDataEncoded(data);
if (r === 1) {
oldCollection = exports.decode(data);
} else if (r === 0) {
oldCollection = JSON.parse(data);
} else if (r === 0) {
oldCollection = this.decode(data);
}

@@ -278,3 +278,3 @@

try {
let collection = this.getItem(parentKey);
let collection = exports.getItem(parentKey);
if (!collection) return false; // terminate process

@@ -299,3 +299,3 @@

// collection
const idx = attrCompare ? this.indexOfObject(collection, value, attrCompare) : -1; // return value
const idx = attrCompare ? exports.indexOfObject(collection, value, attrCompare) : -1; // return value

@@ -331,5 +331,5 @@ if (idx >= 0) {

if (r === 1) {
collection = exports.decode(data);
} else if (r === 0) {
collection = JSON.parse(data);
} else if (r === 0) {
collection = exports.decode(data);
}

@@ -426,8 +426,8 @@

const data = storage.getItem(key);
const r = this.isDataEncoded(data);
const r = exports.isDataEncoded(data);
if (r === 1) {
return exports.decode(data);
} else if (r === 0) {
return JSON.parse(data);
} else if (r === 0) {
return this.decode(data);
} else {

@@ -448,5 +448,5 @@ return data;

exports.isDataEncoded = data => {
if (data.startsWith('{') && data.endsWith('}')) {
if (data.endsWith('==')) {
return 1;
} else if (data.endsWith('==')) {
} else if (data.startsWith('{') && data.endsWith('}')) {
return 0;

@@ -453,0 +453,0 @@ } else {

{
"name": "web-storage-manager",
"version": "1.0.23",
"version": "1.0.24",
"description": "Web utility storage manager to handle save, update and data purge",

@@ -5,0 +5,0 @@ "main": "lib/web-storage-manager.js",

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