Comparing version 0.1.0 to 0.1.1
11
index.js
// @ts-nocheck | ||
function safeParse(string) { | ||
try { | ||
return JSON.parse(string); | ||
} catch { | ||
return undefined; | ||
} | ||
} | ||
export function PetShop({ storage, namespace, json = false }) { | ||
@@ -17,3 +26,3 @@ return Object.defineProperties( | ||
const raw = storage.getItem(`${namespace}.${key}`); | ||
return raw !== null ? JSON.parse(raw) : undefined; | ||
return raw !== null ? safeParse(raw) : undefined; | ||
} | ||
@@ -20,0 +29,0 @@ : function get(key) { |
{ | ||
"name": "pet-shop", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A simple wrapper of Web Storage API", | ||
@@ -32,2 +32,2 @@ "license": "MIT", | ||
"type": "module" | ||
} | ||
} |
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
5065
116