web-storage-manager
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -487,3 +487,2 @@ require("core-js/modules/es7.symbol.async-iterator"); | ||
exports.encode = obj => { | ||
if (!obj || typeof obj !== 'string') return null; | ||
const rawStr = JSON.stringify(obj); | ||
@@ -502,8 +501,13 @@ const encObj = window.btoa(rawStr); | ||
exports.decode = encObj => { | ||
if (!encObj) return null; | ||
const decoded = window.atob(encObj); | ||
if (!decoded) return null; | ||
const obj = JSON.parse(decoded); | ||
console.log('decoded: ', obj); | ||
return obj; | ||
if (!encObj || typeof encObj !== 'string') return null; | ||
try { | ||
const decoded = window.atob(encObj); | ||
const obj = JSON.parse(decoded); | ||
console.log('decoded: ', obj); | ||
return obj; | ||
} catch (error) { | ||
console.log('decoded error: ', error); | ||
return null; | ||
} | ||
}; |
{ | ||
"name": "web-storage-manager", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Web utility storage manager to handle save, update and data purge", | ||
@@ -5,0 +5,0 @@ "main": "lib/web-storage-manager.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17098
415