@analytics/localstorage-utils
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.1](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-localstorage/compare/@analytics/localstorage-utils@0.1.0...@analytics/localstorage-utils@0.1.1) (2021-07-19) | ||
**Note:** Version bump only for package @analytics/localstorage-utils | ||
# 0.1.0 (2021-07-19) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
var e,t="undefined";exports.hasLocalStorage=function(){if(typeof e!==t)return e;e=!0;try{typeof localStorage!==t&&typeof JSON!==t||(e=!1),localStorage.setItem("_"+t,"1"),localStorage.removeItem("_"+t)}catch(t){e=!1}return e}; | ||
var e=require("@analytics/global-storage-utils"),t="undefined",o=r();function r(){if(typeof o!==t)return o;o=!0;try{typeof localStorage!==t&&typeof JSON!==t||(o=!1),localStorage.setItem("_"+t,"1"),localStorage.removeItem("_"+t)}catch(e){o=!1}return o}exports.getItem=function(t){return o?localStorage.getItem(t):e.get(t)},exports.hasLocalStorage=r,exports.removeItem=function(t){return o?localStorage.removeItem(t):e.remove(t)},exports.setItem=function(t,r){return o?localStorage.setItem(t,r):e.set(t,r)}; | ||
//# sourceMappingURL=analytics-util-localstorage.js.map |
@@ -1,2 +0,2 @@ | ||
const e="undefined";let t;function o(){if(typeof t!==e)return t;t=!0;try{typeof localStorage!==e&&typeof JSON!==e||(t=!1),localStorage.setItem("_"+e,"1"),localStorage.removeItem("_"+e)}catch(e){t=!1}return t}export{o as hasLocalStorage}; | ||
import{get as t,set as e,remove as o}from"@analytics/global-storage-utils";const r="undefined";let a=l();function l(){if(typeof a!==r)return a;a=!0;try{typeof localStorage!==r&&typeof JSON!==r||(a=!1),localStorage.setItem("_"+r,"1"),localStorage.removeItem("_"+r)}catch(t){a=!1}return a}function n(e){return a?localStorage.getItem(e):t(e)}function c(t,o){return a?localStorage.setItem(t,o):e(t,o)}function u(t){return a?localStorage.removeItem(t):o(t)}export{n as getItem,l as hasLocalStorage,u as removeItem,c as setItem}; | ||
//# sourceMappingURL=analytics-util-localstorage.modern.js.map |
@@ -1,2 +0,2 @@ | ||
var e,t="undefined";function o(){if(typeof e!==t)return e;e=!0;try{typeof localStorage!==t&&typeof JSON!==t||(e=!1),localStorage.setItem("_"+t,"1"),localStorage.removeItem("_"+t)}catch(t){e=!1}return e}export{o as hasLocalStorage}; | ||
import{get as t,set as e,remove as o}from"@analytics/global-storage-utils";var r="undefined",a=l();function l(){if(typeof a!==r)return a;a=!0;try{typeof localStorage!==r&&typeof JSON!==r||(a=!1),localStorage.setItem("_"+r,"1"),localStorage.removeItem("_"+r)}catch(t){a=!1}return a}function n(e){return a?localStorage.getItem(e):t(e)}function c(t,o){return a?localStorage.setItem(t,o):e(t,o)}function u(t){return a?localStorage.removeItem(t):o(t)}export{n as getItem,l as hasLocalStorage,u as removeItem,c as setItem}; | ||
//# sourceMappingURL=analytics-util-localstorage.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e||self).utilLocalStorage={})}(this,function(e){var o,t="undefined";e.hasLocalStorage=function(){if(typeof o!==t)return o;o=!0;try{typeof localStorage!==t&&typeof JSON!==t||(o=!1),localStorage.setItem("_"+t,"1"),localStorage.removeItem("_"+t)}catch(e){o=!1}return o}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@analytics/global-storage-utils")):"function"==typeof define&&define.amd?define(["exports","@analytics/global-storage-utils"],t):t((e||self).utilLocalStorage={},e.globalStorageUtils)}(this,function(e,t){var o="undefined",a=l();function l(){if(typeof a!==o)return a;a=!0;try{typeof localStorage!==o&&typeof JSON!==o||(a=!1),localStorage.setItem("_"+o,"1"),localStorage.removeItem("_"+o)}catch(e){a=!1}return a}e.getItem=function(e){return a?localStorage.getItem(e):t.get(e)},e.hasLocalStorage=l,e.removeItem=function(e){return a?localStorage.removeItem(e):t.remove(e)},e.setItem=function(e,o){return a?localStorage.setItem(e,o):t.set(e,o)}}); | ||
//# sourceMappingURL=analytics-util-localstorage.umd.js.map |
{ | ||
"name": "@analytics/localstorage-utils", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Tiny LocalStorage utility library", | ||
@@ -49,3 +49,6 @@ "author": "David Wells", | ||
}, | ||
"gitHead": "03e376a8270f7cf425a8cac821ab2d8c9f9d5f4e" | ||
"dependencies": { | ||
"@analytics/global-storage-utils": "^0.1.0" | ||
}, | ||
"gitHead": "6693417b6e42fe35b5fe96c1f804b6580195f561" | ||
} |
@@ -11,5 +11,5 @@ <!-- | ||
Exposes `hasLocalStorage` function. | ||
Exposes `hasLocalStorage`, `getItem`, `setItem`, & `removeItem` functions. | ||
This will work with [analytics](https://getanalytics.io) or as a standalone import in your code. | ||
This modules will automatically fail back to global window storage if `localStorage` is not available in the browser. | ||
@@ -39,1 +39,31 @@ ## How to install | ||
``` | ||
## `getItem` | ||
Get a localStorage value. | ||
```js | ||
import { getItem } from '@analytics/localstorage-utils' | ||
const value = getItem('cookie-key') | ||
``` | ||
## `setItem` | ||
Set a localStorage value. | ||
```js | ||
import { setItem } from '@analytics/localstorage-utils' | ||
setItem('item-key', 'a') | ||
``` | ||
## `removeItem` | ||
Delete a localStorage value. | ||
```js | ||
import { removeItem } from '@analytics/localstorage-utils' | ||
removeItem('key') | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances 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
21088
123
68
1
4
+ Added@analytics/global-storage-utils@0.1.7(transitive)
+ Added@analytics/type-utils@0.6.2(transitive)