You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

analytics-utils

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-utils - npm Package Compare versions

Comparing version

to
0.0.20

@@ -567,5 +567,5 @@ var analyticsUtils = (function (exports) {

* Get storage item from localStorage, cookie, or window
* @param {[type]} key - key of item to get
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to pull from.
* @param {string} key - key of item to get
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @return {Any} the value of key

@@ -577,3 +577,3 @@ */

if (!key) return null;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -600,6 +600,7 @@

* Store values in localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Any} value - value of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {*} value - value of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @returns {object} returns old value, new values, & location of storage
*/

@@ -610,3 +611,3 @@

if (!key || !value) return false;
var storage = options.storage;
var storage = getStorageType(options);
var saveValue = JSON.stringify(value);

@@ -654,5 +655,5 @@ /* 1. Try localStorage */

* Remove values from localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
*/

@@ -663,3 +664,3 @@

if (!key) return false;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -685,2 +686,6 @@

function getStorageType(options) {
return typeof options === 'string' ? options : options.storage;
}
function useLocal(storage) {

@@ -687,0 +692,0 @@ return hasLocalStorage$1 && (!storage || storage === 'localStorage');

@@ -1,1 +0,1 @@

var analyticsUtils=function(e){"use strict";var u="undefined"!=typeof window;var a=function(){try{if(!u)return!1;var e="cookietest=";document.cookie="".concat(e,"1");var t=-1!==document.cookie.indexOf(e);return document.cookie="".concat(e,"1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),t}catch(e){return!1}}();function l(e,t,r){if(!a)return!1;var n="";if(r){var o=new Date;o.setTime(o.getTime()+24*r*60*60*1e3),n="; expires=".concat(o.toGMTString())}document.cookie="".concat(e,"=").concat(t).concat(n,"; path=/")}function f(e){if(!a)return!1;for(var t="".concat(e,"="),r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function n(e){if(!a)return!1;l(e,"",-1)}var t={getCookie:f,setCookie:l,removeCookie:n};function s(e){return decodeURIComponent(e).replace(/\+/g," ")}function m(e){if(!u)return!1;var t=e||document.referrer;if(t){var r=window.document.location.port,n=t.split("/")[2];return r&&(n=n.replace(":".concat(r),"")),n!==window.location.hostname}return!1}function c(e,t){var r=(e.split("?")||[,])[1];if(!r||-1===r.indexOf(t))return e;var n=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.%]+)'),"g"),o="?".concat(r).replace(n,"").replace(/^&/,"?");return e.replace("?".concat(r),o)}function i(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return u&&window.location.search.substring(1)}(e);return t?function(e){var t,r=/([^&=]+)=?([^&]*)/g,n={};for(;t=r.exec(e);){var o=s(t[1]),a=s(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(n[o]||(n[o]=[])).push(a);else{var c=""===a||a;n[o]=c}}for(var i in n){var u=i.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var r=e.replace(/[?[\]\\ ]/g,"");l.push(r)}),g(n,l,n[i]),delete n[i]}}return n}(t):{}}function g(e,t,r){for(var n=t.length-1,o=0;o<n;++o){var a=t[o];a in e||(e[a]={}),e=e[a]}e[t[n]]=r}function r(e){if(!u)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function d(e){return(r(e)||"").split(".").slice(-2).join(".")}function v(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var o={trimTld:v,getDomainBase:d,getDomainHost:r},p="google";var h={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function y(e){return(y="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 w(t){var r;try{void 0===(r=JSON.parse(t))&&(r=t),"true"===r&&(r=!0),"false"===r&&(r=!1),parseFloat(r)===r&&"object"!==y(r)&&(r=parseFloat(r))}catch(e){r=t}return r}var b="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0;var S=function(){if(!u)return!1;try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(e){return!1}return!0}();function k(e){return S&&(!e||"localStorage"===e)}function x(e){return a&&(!e||"cookie"===e)}var O={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var r=t.storage;if(k(r)){var n=localStorage.getItem(e);if(n||"localStorage"===r)return w(n)}if(x(r)){var o=f(e);if(o||"cookie"===r)return w(o)}return b[e]||null},setItem:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var n=r.storage,o=JSON.stringify(t);if(k(n)){var a=w(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:a,type:"localStorage"}}if(x(n)){var c=w(f(e));return l(e,o),{value:t,oldValue:c,type:"cookie"}}var i=b[e];return{value:b[e]=t,oldValue:i,type:"window"}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var r=t.storage;return k(r)?(localStorage.removeItem(e),null):x(r)?(n(e),null):b[e]=null}};function q(){return 4294967295*Math.random()|0}return e.cookie=t,e.decodeUri=s,e.getBrowserLocale=function(){if(!u)return null;var e=navigator,t=e.language,r=e.languages,n=e.userLanguage;return r&&r.length?r[0]:n||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=u,e.isExternalReferrer=m,e.isScriptLoaded=function(r){if(!u)return!0;var n=document.getElementsByTagName("script");return!!Object.keys(n).filter(function(e){var t=n[e].src;return"string"==typeof r?-1!==t.indexOf(r):r instanceof RegExp&&t.match(r)}).length},e.noOp=function(){},e.paramsClean=c,e.paramsGet=function(e,t){return s((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=i,e.paramsRemove=function(o,a){return u?new Promise(function(e,t){if(window.history&&window.history.replaceState){var r=window.location.href,n=c(r,o);r!==n&&history.replaceState({},"",n)}return a&&a(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!u)return!1;var r={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&m(e)&&(r.referrer=e);var n=function(e){if(!e||!u)return!1;var t=d(e),r=document.createElement("a");if(r.href=e,-1<r.hostname.indexOf(p)&&(t=p),h[t]){var n=h[t],o="string"==typeof n?n:n.p,a=new RegExp(o+"=.*?([^&#]*|$)","gi"),c=r.search.match(a);return{source:n.n||v(t),medium:"organic",term:(c?c[0].split("=")[1]:"")||"(not provided)"}}var i=m(e)?"referral":"internal";return{source:r.hostname,medium:i}}(e);n&&Object.keys(n).length&&(r=Object.assign({},r,n));var o=i(t),a=Object.keys(o);if(a.length){var c=a.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=p,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});r=Object.assign({},r,c),(o.dclid||o.gclid)&&(r.source=p,r.medium=o.gclid?"cpc":"cpm")}return r},e.storage=O,e.url=o,e.uuid=function(){for(var e,t,r,n,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return e=q(),t=q(),r=q(),n=q(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&r|128]).concat(o[r>>8&255],"-").concat(o[r>>16&255]).concat(o[r>>24&255]).concat(o[255&n]).concat(o[n>>8&255]).concat(o[n>>16&255]).concat(o[n>>24&255])},e.globalContext=b,e}({});
var analyticsUtils=function(e){"use strict";var u="undefined"!=typeof window;var a=function(){try{if(!u)return!1;var e="cookietest=";document.cookie="".concat(e,"1");var t=-1!==document.cookie.indexOf(e);return document.cookie="".concat(e,"1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),t}catch(e){return!1}}();function l(e,t,n){if(!a)return!1;var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires=".concat(o.toGMTString())}document.cookie="".concat(e,"=").concat(t).concat(r,"; path=/")}function f(e){if(!a)return!1;for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function r(e){if(!a)return!1;l(e,"",-1)}var t={getCookie:f,setCookie:l,removeCookie:r};function s(e){return decodeURIComponent(e).replace(/\+/g," ")}function m(e){if(!u)return!1;var t=e||document.referrer;if(t){var n=window.document.location.port,r=t.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function c(e,t){var n=(e.split("?")||[,])[1];if(!n||-1===n.indexOf(t))return e;var r=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return e.replace("?".concat(n),o)}function i(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return u&&window.location.search.substring(1)}(e);return t?function(e){var t,n=/([^&=]+)=?([^&]*)/g,r={};for(;t=n.exec(e);){var o=s(t[1]),a=s(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var c=""===a||a;r[o]=c}}for(var i in r){var u=i.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var n=e.replace(/[?[\]\\ ]/g,"");l.push(n)}),g(r,l,r[i]),delete r[i]}}return r}(t):{}}function g(e,t,n){for(var r=t.length-1,o=0;o<r;++o){var a=t[o];a in e||(e[a]={}),e=e[a]}e[t[r]]=n}function n(e){if(!u)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function d(e){return(n(e)||"").split(".").slice(-2).join(".")}function v(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var o={trimTld:v,getDomainBase:d,getDomainHost:n},p="google";var h={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function y(e){return(y="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 w(t){var n;try{void 0===(n=JSON.parse(t))&&(n=t),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==y(n)&&(n=parseFloat(n))}catch(e){n=t}return n}var b="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0;var S=function(){if(!u)return!1;try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(e){return!1}return!0}();function k(e){return"string"==typeof e?e:e.storage}function x(e){return S&&(!e||"localStorage"===e)}function O(e){return a&&(!e||"cookie"===e)}var q={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var n=k(t);if(x(n)){var r=localStorage.getItem(e);if(r||"localStorage"===n)return w(r)}if(O(n)){var o=f(e);if(o||"cookie"===n)return w(o)}return b[e]||null},setItem:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var r=k(n),o=JSON.stringify(t);if(x(r)){var a=w(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:a,type:"localStorage"}}if(O(r)){var c=w(f(e));return l(e,o),{value:t,oldValue:c,type:"cookie"}}var i=b[e];return{value:b[e]=t,oldValue:i,type:"window"}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var n=k(t);return x(n)?(localStorage.removeItem(e),null):O(n)?(r(e),null):b[e]=null}};function I(){return 4294967295*Math.random()|0}return e.cookie=t,e.decodeUri=s,e.getBrowserLocale=function(){if(!u)return null;var e=navigator,t=e.language,n=e.languages,r=e.userLanguage;return n&&n.length?n[0]:r||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=u,e.isExternalReferrer=m,e.isScriptLoaded=function(n){if(!u)return!0;var r=document.getElementsByTagName("script");return!!Object.keys(r).filter(function(e){var t=r[e].src;return"string"==typeof n?-1!==t.indexOf(n):n instanceof RegExp&&t.match(n)}).length},e.noOp=function(){},e.paramsClean=c,e.paramsGet=function(e,t){return s((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=i,e.paramsRemove=function(o,a){return u?new Promise(function(e,t){if(window.history&&window.history.replaceState){var n=window.location.href,r=c(n,o);n!==r&&history.replaceState({},"",r)}return a&&a(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!u)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&m(e)&&(n.referrer=e);var r=function(e){if(!e||!u)return!1;var t=d(e),n=document.createElement("a");if(n.href=e,-1<n.hostname.indexOf(p)&&(t=p),h[t]){var r=h[t],o="string"==typeof r?r:r.p,a=new RegExp(o+"=.*?([^&#]*|$)","gi"),c=n.search.match(a);return{source:r.n||v(t),medium:"organic",term:(c?c[0].split("=")[1]:"")||"(not provided)"}}var i=m(e)?"referral":"internal";return{source:n.hostname,medium:i}}(e);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=i(t),a=Object.keys(o);if(a.length){var c=a.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=p,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});n=Object.assign({},n,c),(o.dclid||o.gclid)&&(n.source=p,n.medium=o.gclid?"cpc":"cpm")}return n},e.storage=q,e.url=o,e.uuid=function(){for(var e,t,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return e=I(),t=I(),n=I(),r=I(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])},e.globalContext=b,e}({});

@@ -568,5 +568,5 @@ 'use strict';

* Get storage item from localStorage, cookie, or window
* @param {[type]} key - key of item to get
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to pull from.
* @param {string} key - key of item to get
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @return {Any} the value of key

@@ -578,3 +578,3 @@ */

if (!key) return null;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -601,6 +601,7 @@

* Store values in localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Any} value - value of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {*} value - value of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @returns {object} returns old value, new values, & location of storage
*/

@@ -611,3 +612,3 @@

if (!key || !value) return false;
var storage = options.storage;
var storage = getStorageType(options);
var saveValue = JSON.stringify(value);

@@ -655,5 +656,5 @@ /* 1. Try localStorage */

* Remove values from localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
*/

@@ -664,3 +665,3 @@

if (!key) return false;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -686,2 +687,6 @@

function getStorageType(options) {
return typeof options === 'string' ? options : options.storage;
}
function useLocal(storage) {

@@ -688,0 +693,0 @@ return hasLocalStorage$1 && (!storage || storage === 'localStorage');

@@ -564,5 +564,5 @@ var inBrowser = typeof window !== 'undefined';

* Get storage item from localStorage, cookie, or window
* @param {[type]} key - key of item to get
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to pull from.
* @param {string} key - key of item to get
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @return {Any} the value of key

@@ -574,3 +574,3 @@ */

if (!key) return null;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -597,6 +597,7 @@

* Store values in localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Any} value - value of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {*} value - value of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @returns {object} returns old value, new values, & location of storage
*/

@@ -607,3 +608,3 @@

if (!key || !value) return false;
var storage = options.storage;
var storage = getStorageType(options);
var saveValue = JSON.stringify(value);

@@ -651,5 +652,5 @@ /* 1. Try localStorage */

* Remove values from localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
*/

@@ -660,3 +661,3 @@

if (!key) return false;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -682,2 +683,6 @@

function getStorageType(options) {
return typeof options === 'string' ? options : options.storage;
}
function useLocal(storage) {

@@ -684,0 +689,0 @@ return hasLocalStorage$1 && (!storage || storage === 'localStorage');

@@ -568,5 +568,5 @@ 'use strict';

* Get storage item from localStorage, cookie, or window
* @param {[type]} key - key of item to get
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to pull from.
* @param {string} key - key of item to get
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @return {Any} the value of key

@@ -578,3 +578,3 @@ */

if (!key) return null;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -601,6 +601,7 @@

* Store values in localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Any} value - value of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {*} value - value of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @returns {object} returns old value, new values, & location of storage
*/

@@ -611,3 +612,3 @@

if (!key || !value) return false;
var storage = options.storage;
var storage = getStorageType(options);
var saveValue = JSON.stringify(value);

@@ -655,5 +656,5 @@ /* 1. Try localStorage */

* Remove values from localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
*/

@@ -664,3 +665,3 @@

if (!key) return false;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -686,2 +687,6 @@

function getStorageType(options) {
return typeof options === 'string' ? options : options.storage;
}
function useLocal(storage) {

@@ -688,0 +693,0 @@ return hasLocalStorage$1 && (!storage || storage === 'localStorage');

@@ -564,5 +564,5 @@ var inBrowser = typeof window !== 'undefined';

* Get storage item from localStorage, cookie, or window
* @param {[type]} key - key of item to get
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to pull from.
* @param {string} key - key of item to get
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @return {Any} the value of key

@@ -574,3 +574,3 @@ */

if (!key) return null;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -597,6 +597,7 @@

* Store values in localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Any} value - value of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {*} value - value of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
* @returns {object} returns old value, new values, & location of storage
*/

@@ -607,3 +608,3 @@

if (!key || !value) return false;
var storage = options.storage;
var storage = getStorageType(options);
var saveValue = JSON.stringify(value);

@@ -651,5 +652,5 @@ /* 1. Try localStorage */

* Remove values from localStorage, cookie, or window
* @param {String} key - key of item to set
* @param {Object} opts - (optional)
* @param {String} opts.storage - Define type of storage to set to.
* @param {string} key - key of item to set
* @param {object|string} [options] - storage options. If string location of where to get storage
* @param {string} [options.storage] - Define type of storage to pull from.
*/

@@ -660,3 +661,3 @@

if (!key) return false;
var storage = options.storage;
var storage = getStorageType(options);
/* 1. Try localStorage */

@@ -682,2 +683,6 @@

function getStorageType(options) {
return typeof options === 'string' ? options : options.storage;
}
function useLocal(storage) {

@@ -684,0 +689,0 @@ return hasLocalStorage$1 && (!storage || storage === 'localStorage');

{
"name": "analytics-utils",
"version": "0.0.19",
"version": "0.0.20",
"description": "Analytics utility functions",

@@ -57,3 +57,3 @@ "author": "David Wells <hello@davidwells.io>",

},
"gitHead": "f224554ce7e0afb287944ed95ef513587df0f7dd"
"gitHead": "bfae6bfd610da3b56e2f050dd15172220d60be4c"
}