@analytics/storage-utils
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.2.9](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage/compare/@analytics/storage-utils@0.2.8...@analytics/storage-utils@0.2.9) (2021-07-28) | ||
**Note:** Version bump only for package @analytics/storage-utils | ||
## [0.2.8](https://github.com/DavidWells/analytics/compare/@analytics/storage-utils@0.2.7...@analytics/storage-utils@0.2.8) (2021-07-26) | ||
@@ -8,0 +16,0 @@ |
@@ -67,25 +67,25 @@ var analyticsUtilStorage = (function (exports) { | ||
var l = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0; | ||
var l = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0, | ||
e = "undefined"; | ||
function o(o) { | ||
return l[o]; | ||
function o(e) { | ||
return l[e]; | ||
} | ||
function e(o, e) { | ||
return l[o] = e, e; | ||
function f(e, o) { | ||
return l[e] = o, o; | ||
} | ||
function f(l) { | ||
e(l, void 0); | ||
function n(l) { | ||
f(l); | ||
} | ||
var r = "undefined", | ||
a = l$1(); | ||
var a = l$1(); | ||
function l$1(t) { | ||
if (void 0 === t && (t = !1), typeof a !== r && !t) return a; | ||
function l$1() { | ||
if (typeof a !== e) return a; | ||
a = !0; | ||
try { | ||
typeof localStorage !== r && typeof JSON !== r || (a = !1), localStorage.setItem("_" + r, "1"), localStorage.removeItem("_" + r); | ||
typeof localStorage !== e && typeof JSON !== e || (a = !1), localStorage.setItem(e, e), localStorage.removeItem(e); | ||
} catch (t) { | ||
@@ -98,17 +98,15 @@ a = !1; | ||
var n$1 = "undefined", | ||
i = a$1(), | ||
r$1 = d, | ||
c$1 = d; | ||
var i = a$1(), | ||
r = p, | ||
c$1 = p; | ||
function u$1(e$$1) { | ||
return i ? d(e$$1, "", -1) : f(e$$1); | ||
return i ? p(e$$1, "", -1) : n(e$$1); | ||
} | ||
function a$1(e$$1) { | ||
if (void 0 === e$$1 && (e$$1 = !1), typeof i !== n$1 && !e$$1) return i; | ||
function a$1() { | ||
if (typeof i !== e) return i; | ||
try { | ||
var o$$1 = "_" + n$1; | ||
d(o$$1, "1"), i = -1 !== document.cookie.indexOf(o$$1), d(o$$1, "", -1); | ||
p(e, "1"), i = -1 !== document.cookie.indexOf(e), u$1(e); | ||
} catch (e$$1) { | ||
@@ -121,6 +119,6 @@ i = !1; | ||
function d(t, r, c, u, a, d) { | ||
if (typeof window !== n$1) { | ||
var f$$1 = arguments.length > 1; | ||
return i || (f$$1 ? e(t, r) : o(t)), f$$1 ? document.cookie = t + "=" + encodeURIComponent(r) + (c ? "; expires=" + new Date(+new Date() + 1e3 * c).toUTCString() + (u ? "; path=" + u : "") + (a ? "; domain=" + a : "") + (d ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + t + "=")[1] || "").split(";")[0]); | ||
function p(t, r, c, u, a, p) { | ||
if (typeof window !== e) { | ||
var d = arguments.length > 1; | ||
return i || (d ? f(t, r) : o(t)), d ? document.cookie = t + "=" + encodeURIComponent(r) + (c ? "; expires=" + new Date(+new Date() + 1e3 * c).toUTCString() + (u ? "; path=" + u : "") + (a ? "; domain=" + a : "") + (p ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + t + "=")[1] || "").split(";")[0]); | ||
} | ||
@@ -188,3 +186,3 @@ } | ||
if (useCookie(storageType)) { | ||
var _value = r$1(key); | ||
var _value = r(key); | ||
@@ -201,3 +199,3 @@ if (_value || storageType === COOKIE) return parse(_value); | ||
return { | ||
cookie: parse(r$1(key)), | ||
cookie: parse(r(key)), | ||
localStorage: parse(localStorage.getItem(key)), | ||
@@ -255,3 +253,3 @@ global: o(key) | ||
current: value, | ||
previous: parse(r$1(key)) // Set Cookie | ||
previous: parse(r(key)) // Set Cookie | ||
@@ -278,3 +276,3 @@ }; | ||
}; | ||
e(key, value); | ||
f(key, value); | ||
@@ -320,3 +318,3 @@ if (!setAll) { | ||
if (removeAll || useGlobal(storageType)) { | ||
f(key); | ||
n(key); | ||
locations.push(GLOBAL); | ||
@@ -362,3 +360,3 @@ } | ||
exports.removeItem = removeItem; | ||
exports.getCookie = r$1; | ||
exports.getCookie = r; | ||
exports.setCookie = c$1; | ||
@@ -365,0 +363,0 @@ exports.removeCookie = u$1; |
@@ -1,1 +0,1 @@ | ||
var analyticsUtilStorage=function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var i="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0;function a(e){return i[e]}function c(e,t){return i[e]=t,t}function u(e){c(e,void 0)}var f="undefined",l=s();function s(e){if(void 0===e&&(e=!1),typeof l!==f&&!e)return l;l=!0;try{typeof localStorage!==f&&typeof JSON!==f||(l=!1),localStorage.setItem("_"+f,"1"),localStorage.removeItem("_"+f)}catch(e){l=!1}return l}var p="undefined",g=b(),v=d,y=d;function m(e){return g?d(e,"",-1):u(e)}function b(e){if(void 0===e&&(e=!1),typeof g!==p&&!e)return g;try{var t="_"+p;d(t,"1"),g=-1!==document.cookie.indexOf(t),d(t,"",-1)}catch(e){g=!1}return g}function d(e,t,o,r,n,i){if(typeof window!==p){var u=arguments.length>1;return g||(u?c(e,t):a(e)),u?document.cookie=e+"="+encodeURIComponent(t)+(o?"; expires="+new Date(+new Date+1e3*o).toUTCString()+(r?"; path="+r:"")+(n?"; domain="+n:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}function O(e){var o;try{void 0===(o=JSON.parse(e))&&(o=e),"true"===o&&(o=!0),"false"===o&&(o=!1),parseFloat(o)===o&&"object"!==t(o)&&(o=parseFloat(o))}catch(t){o=e}return o}var S="*",h="localStorage",I="cookie",j="global",w=s(),k=b();function C(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var o=D(t);if(o===S)return function(e){return{cookie:O(v(e)),localStorage:O(localStorage.getItem(e)),global:a(e)}}(e);if(A(o)){var r=localStorage.getItem(e);if(r||o===h)return O(r)}if(E(o)){var n=v(e);if(n||o===I)return O(n)}return a(e)}}function P(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&void 0!==t){var r={},i=D(o),u=JSON.stringify(t),f=i===S;if(A(i)){var l={current:t,previous:O(localStorage.getItem(e))};if(localStorage.setItem(e,u),!f)return n({location:h},l);r[h]=l}if(E(i)){var s={current:t,previous:O(v(e))};if(y(e,u),!f)return n({location:I},s);r[I]=s}var p={current:t,previous:a(e)};return c(e,t),f?(r[j]=p,r):n({location:j},p)}}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var o=D(t),r=o===S,n=[];return(r||A(o))&&(localStorage.removeItem(e),n.push(h)),(r||E(o))&&(m(e),n.push(I)),(r||U(o,j))&&(u(e),n.push(j)),n}}function D(e){return"string"==typeof e?e:e.storage}function A(e){return w&&U(e,h)}function E(e){return k&&U(e,I)}function U(e,t){return!e||e===t||e===S}var _={getItem:C,setItem:P,removeItem:L};return e.ALL=S,e.LOCAL_STORAGE=h,e.COOKIE=I,e.GLOBAL=j,e.getItem=C,e.setItem=P,e.removeItem=L,e.getCookie=v,e.setCookie=y,e.removeCookie=m,e.globalContext=i,e.hasLocalStorage=s,e.hasCookies=b,e.default=_,e}({}); | ||
var analyticsUtilStorage=function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(n,!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var i="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,c="undefined";function a(e){return i[e]}function u(e,t){return i[e]=t,t}function l(e){u(e)}var f=s();function s(){if(typeof f!==c)return f;f=!0;try{typeof localStorage!==c&&typeof JSON!==c||(f=!1),localStorage.setItem(c,c),localStorage.removeItem(c)}catch(e){f=!1}return f}var p=m(),g=b,v=b;function y(e){return p?b(e,"",-1):l(e)}function m(){if(typeof p!==c)return p;try{b(c,"1"),p=-1!==document.cookie.indexOf(c),y(c)}catch(e){p=!1}return p}function b(e,t,r,o,n,i){if(typeof window!==c){var l=arguments.length>1;return p||(l?u(e,t):a(e)),l?document.cookie=e+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(o?"; path="+o:"")+(n?"; domain="+n:"")+(i?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}function O(e){var r;try{void 0===(r=JSON.parse(e))&&(r=e),"true"===r&&(r=!0),"false"===r&&(r=!1),parseFloat(r)===r&&"object"!==t(r)&&(r=parseFloat(r))}catch(t){r=e}return r}var S="*",d="localStorage",h="cookie",I="global",j=s(),w=m();function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var r=L(t);if(r===S)return function(e){return{cookie:O(g(e)),localStorage:O(localStorage.getItem(e)),global:a(e)}}(e);if(D(r)){var o=localStorage.getItem(e);if(o||r===d)return O(o)}if(A(r)){var n=g(e);if(n||r===h)return O(n)}return a(e)}}function C(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&void 0!==t){var o={},i=L(r),c=JSON.stringify(t),l=i===S;if(D(i)){var f={current:t,previous:O(localStorage.getItem(e))};if(localStorage.setItem(e,c),!l)return n({location:d},f);o[d]=f}if(A(i)){var s={current:t,previous:O(g(e))};if(v(e,c),!l)return n({location:h},s);o[h]=s}var p={current:t,previous:a(e)};return u(e,t),l?(o[I]=p,o):n({location:I},p)}}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e){var r=L(t),o=r===S,n=[];return(o||D(r))&&(localStorage.removeItem(e),n.push(d)),(o||A(r))&&(y(e),n.push(h)),(o||E(r,I))&&(l(e),n.push(I)),n}}function L(e){return"string"==typeof e?e:e.storage}function D(e){return j&&E(e,d)}function A(e){return w&&E(e,h)}function E(e,t){return!e||e===t||e===S}var U={getItem:k,setItem:C,removeItem:P};return e.ALL=S,e.LOCAL_STORAGE=d,e.COOKIE=h,e.GLOBAL=I,e.getItem=k,e.setItem=C,e.removeItem=P,e.getCookie=g,e.setCookie=v,e.removeCookie=y,e.globalContext=i,e.hasLocalStorage=s,e.hasCookies=m,e.default=U,e}({}); |
{ | ||
"name": "@analytics/storage-utils", | ||
"version": "0.2.8", | ||
"description": "Storage utilities for saving values in browser", | ||
"version": "0.2.9", | ||
"description": "Storage utility with fallbacks", | ||
"author": "David Wells", | ||
"license": "MIT", | ||
"homepage": "https://github.com/DavidWells/analytics#readme", | ||
"homepage": "https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage#readme", | ||
"repository": "https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-storage", | ||
"keywords": [ | ||
@@ -17,18 +18,26 @@ "analytics", | ||
], | ||
"main": "lib/analytics-util-storage.cjs.js", | ||
"globalName": "analyticsUtilStorage", | ||
"jsnext:main": "lib/analytics-util-storage.es.js", | ||
"module": "lib/analytics-util-storage.es.js", | ||
"browser": { | ||
"./lib/analytics-util-storage.cjs.js": "./lib/analytics-util-storage.browser.cjs.js", | ||
"./lib/analytics-util-storage.es.js": "./lib/analytics-util-storage.browser.es.js" | ||
}, | ||
"netlifySiteId": "8e3043e9-1557-4849-b4cc-ead830d41e01", | ||
"amdName": "utilStorage", | ||
"source": "src/index.js", | ||
"main": "dist/analytics-util-storage.js", | ||
"module": "dist/analytics-util-storage.module.js", | ||
"unpkg": "dist/analytics-util-storage.umd.js", | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "node ../../scripts/build/index.js", | ||
"watch": "node ../../scripts/build/_watch.js", | ||
"start": "npm run sync && concurrently 'npm:watch' 'npm:serve'", | ||
"test": "uvu -r esm tests", | ||
"serve": "servor dist index.html 8081 --reload --browse", | ||
"watch:test": "watchlist src tests -- npm run test", | ||
"watch:copy": "watchlist example -- npm run sync", | ||
"watch:build": "npm run build:browser -- --watch --no-compress", | ||
"sync": "cp example/index.html dist", | ||
"watch": "concurrently 'npm:watch:*'", | ||
"build": "concurrently 'npm:build:*' && npm run sync", | ||
"build:package": "microbundle", | ||
"build:browser": "microbundle build --external none -f iife,umd -o dist/browser", | ||
"build:no-deps": "microbundle build -f iife,umd -o dist/browser-no-deps", | ||
"release:patch": "npm version patch && npm publish", | ||
"release:minor": "npm version minor && npm publish", | ||
"release:major": "npm version major && npm publish", | ||
"es": "../../node_modules/.bin/babel-node ./testBabel.js" | ||
"deploy": "npm run build && netlify deploy --prod --dir dist --site $npm_package_netlifySiteId" | ||
}, | ||
@@ -42,16 +51,17 @@ "files": [ | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/DavidWells/analytics.git" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5" | ||
"concurrently": "^6.1.0", | ||
"esm": "^3.2.25", | ||
"microbundle": "^0.13.0", | ||
"servor": "^4.0.2", | ||
"uvu": "^0.5.1", | ||
"watchlist": "^0.2.3" | ||
}, | ||
"dependencies": { | ||
"@analytics/cookie-utils": "^0.2.5", | ||
"@analytics/global-storage-utils": "^0.1.1", | ||
"@analytics/localstorage-utils": "^0.1.4" | ||
"@analytics/cookie-utils": "^0.2.6", | ||
"@analytics/global-storage-utils": "^0.1.2", | ||
"@analytics/localstorage-utils": "^0.1.5", | ||
"@analytics/type-utils": "^0.1.0" | ||
}, | ||
"gitHead": "285f64dc43c4a332de48785c22a452dc6805f993" | ||
"gitHead": "73afae2f710821b7cec2c41d949aad4633f38afa" | ||
} |
@@ -9,3 +9,3 @@ <!-- | ||
A tiny storage utility library with fallback mechanism in <!-- AUTO-GENERATED-CONTENT:START (pkgSize:src=./dist/@analytics/storage-utils.min.js) -->`1.41kb`<!-- AUTO-GENERATED-CONTENT:END --> . | ||
A tiny storage utility library with fallback mechanism in <!-- AUTO-GENERATED-CONTENT:START (pkgSize:src=./dist/@analytics/storage-utils.min.js) -->`1.38kb`<!-- AUTO-GENERATED-CONTENT:END --> . | ||
@@ -12,0 +12,0 @@ By default, `@analytics/storage-utils` will persist values in browser in this order: |
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
431349
29
8193
4
6
4
1
1
+ Added@analytics/type-utils@^0.1.0
+ Added@analytics/type-utils@0.1.0(transitive)