New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browser-ls

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-ls - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

LICENCE

2

dist/ls.min.js

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.ls=t()}}(function(){var t;return function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(o)return o(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(t,e){"use strict";var n=t("./lib/LocalStorage");e.exports=new n,e.exports.getAdapter=function(t){var e=new n(t);return e}},{"./lib/LocalStorage":2}],2:[function(t,e){"use strict";function n(t){return t||function(){}}function r(t,e){return""===t?t.concat(e):t.concat(".").concat(e)}function i(t){if(s.EventEmitter.call(this),this.ns=t||"","string"!=typeof this.ns)throw new Error("Namespace must be a string.");this.EVENTS=l}var o=window.localStorage,u=t("safejson"),s=t("events"),c=t("async"),a=t("util"),l={SET:"SET",SET_FAILED:"SET_FAILED",GET:"GET",GET_FAILED:"GET_FAILED",REMOVE:"REMOVE",REMOVE_FAILED:"REMOVE_FAILED"};a.inherits(i,s.EventEmitter),e.exports=i,i.prototype.getNs=function(){return this.ns},i.prototype.getKeys=function(){var t=Object.keys(o),e=this.getNs().concat(".");return t.filter(function(t){return 0===t.indexOf(e)}).map(function(t){return t.replace(e,"")})},i.prototype.set=function(t,e,i){i=n(i);try{o.setItem(r(this.getNs(),t),e),i(null,null),this.emit(l.SET,t,e)}catch(u){i(u,null),this.emit(l.SET_FAILED,t,e)}},i.prototype.setJson=function(t,e,r){var i=this;r=n(r),u.stringify(e,function(n,o){n?(r(n,null),i.emit(l.SET_FAILED,t,e)):i.set(t,o,r)})},i.prototype.get=function(t,e,i){e=n(e);try{var u=o.getItem(r(this.getNs(),t));e(null,u),i||this.emit(l.GET,t,u)}catch(s){i||this.emit(l.GET_FAILED,t),e(s,null)}},i.prototype.clear=function(t){c.eachSeries(this.getKeys(),this.remove.bind(this),function(e){t(e||null,null)})},i.prototype.getJson=function(t,e){e=n(e);var r=this;this.get(t,function(n,i){n?(e(n,null),r.emit(l.GET_FAILED,t)):u.parse(i,function(n,i){n?(e(n,null),r.emit(l.GET_FAILED,t)):(e(null,i),r.emit(l.GET,t,i))})},!0)},i.prototype.remove=function(t,e){e=n(e);try{o.removeItem(r(this.getNs(),t)),e(null,null),this.emit(l.REMOVE,t)}catch(i){e(i,null),this.emit(l.REMOVE_FAILED,t)}}},{async:3,events:4,safejson:9,util:8}],3:[function(e,n){(function(e){!function(){function r(t){var e=!1;return function(){if(e)throw new Error("Callback was already called.");e=!0,t.apply(i,arguments)}}var i,o,u={};i=this,null!=i&&(o=i.async),u.noConflict=function(){return i.async=o,u};var s=Object.prototype.toString,c=Array.isArray||function(t){return"[object Array]"===s.call(t)},a=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n+=1)e(t[n],n,t)},l=function(t,e){if(t.map)return t.map(e);var n=[];return a(t,function(t,r,i){n.push(e(t,r,i))}),n},f=function(t,e,n){return t.reduce?t.reduce(e,n):(a(t,function(t,r,i){n=e(n,t,r,i)}),n)},p=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e};"undefined"!=typeof e&&e.nextTick?(u.nextTick=e.nextTick,u.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(t){setImmediate(t)},u.setImmediate=u.nextTick):(u.nextTick=function(t){setTimeout(t,0)},u.setImmediate=u.nextTick),u.each=function(t,e,n){function i(e){e?(n(e),n=function(){}):(o+=1,o>=t.length&&n())}if(n=n||function(){},!t.length)return n();var o=0;a(t,function(t){e(t,r(i))})},u.forEach=u.each,u.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n():i())})};i()},u.forEachSeries=u.eachSeries,u.eachLimit=function(t,e,n,r){var i=h(e);i.apply(null,[t,n,r])},u.forEachLimit=u.eachLimit;var h=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var i=0,o=0,u=0;!function s(){if(i>=e.length)return r();for(;t>u&&o<e.length;)o+=1,u+=1,n(e[o-1],function(t){t?(r(t),r=function(){}):(i+=1,u-=1,i>=e.length?r():s())})}()}},y=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[u.each].concat(e))}},d=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[h(t)].concat(n))}},v=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[u.eachSeries].concat(e))}},m=function(t,e,n,r){if(e=l(e,function(t,e){return{index:e,value:t}}),r){var i=[];t(e,function(t,e){n(t.value,function(n,r){i[t.index]=r,e(n)})},function(t){r(t,i)})}else t(e,function(t,e){n(t.value,function(t){e(t)})})};u.map=y(m),u.mapSeries=v(m),u.mapLimit=function(t,e,n,r){return g(e)(t,n,r)};var g=function(t){return d(t,m)};u.reduce=function(t,e,n,r){u.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(t,e,n,r){var i=l(t,function(t){return t}).reverse();u.reduce(i,e,n,r)},u.foldr=u.reduceRight;var E=function(t,e,n,r){var i=[];e=l(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&i.push(t),e()})},function(){r(l(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};u.filter=y(E),u.filterSeries=v(E),u.select=u.filter,u.selectSeries=u.filterSeries;var w=function(t,e,n,r){var i=[];e=l(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||i.push(t),e()})},function(){r(l(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};u.reject=y(w),u.rejectSeries=v(w);var b=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(){r()})};u.detect=y(b),u.detectSeries=v(b),u.some=function(t,e,n){u.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},function(){n(!1)})},u.any=u.some,u.every=function(t,e,n){u.each(t,function(t,r){e(t,function(t){t||(n(!1),n=function(){}),r()})},function(){n(!0)})},u.all=u.every,u.sortBy=function(t,e,n){u.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);var r=function(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0};n(null,l(e.sort(r),function(t){return t.value}))})},u.auto=function(t,e){e=e||function(){};var n=p(t),r=n.length;if(!r)return e();var i={},o=[],s=function(t){o.unshift(t)},l=function(t){for(var e=0;e<o.length;e+=1)if(o[e]===t)return void o.splice(e,1)},h=function(){r--,a(o.slice(0),function(t){t()})};s(function(){if(!r){var t=e;e=function(){},t(null,i)}}),a(n,function(n){var r=c(t[n])?t[n]:[t[n]],o=function(t){var r=Array.prototype.slice.call(arguments,1);if(r.length<=1&&(r=r[0]),t){var o={};a(p(i),function(t){o[t]=i[t]}),o[n]=r,e(t,o),e=function(){}}else i[n]=r,u.setImmediate(h)},y=r.slice(0,Math.abs(r.length-1))||[],d=function(){return f(y,function(t,e){return t&&i.hasOwnProperty(e)},!0)&&!i.hasOwnProperty(n)};if(d())r[r.length-1](o,i);else{var v=function(){d()&&(l(v),r[r.length-1](o,i))};s(v)}})},u.retry=function(t,e,n){var r=5,i=[];"function"==typeof t&&(n=e,e=t,t=r),t=parseInt(t,10)||r;var o=function(r,o){for(var s=function(t,e){return function(n){t(function(t,r){n(!t||e,{err:t,result:r})},o)}};t;)i.push(s(e,!(t-=1)));u.series(i,function(t,e){e=e[e.length-1],(r||n)(e.err,e.result)})};return n?o():o},u.waterfall=function(t,e){if(e=e||function(){},!c(t)){var n=new Error("First argument to waterfall must be an array of functions");return e(n)}if(!t.length)return e();var r=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=t.next();i.push(o?r(o):e),u.setImmediate(function(){t.apply(null,i)})}}};r(u.iterator(t))()};var _=function(t,e,n){if(n=n||function(){},c(e))t.map(e,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),e.call(null,t,n)})},n);else{var r={};t.each(p(e),function(t,n){e[t](function(e){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),r[t]=i,n(e)})},function(t){n(t,r)})}};u.parallel=function(t,e){_({map:u.map,each:u.each},t,e)},u.parallelLimit=function(t,e,n){_({map:g(e),each:h(e)},t,n)},u.series=function(t,e){if(e=e||function(){},c(t))u.mapSeries(t,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),e.call(null,t,n)})},e);else{var n={};u.eachSeries(p(t),function(e,r){t[e](function(t){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),n[e]=i,r(t)})},function(t){e(t,n)})}},u.iterator=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return n<t.length-1?e(n+1):null},r};return e(0)},u.apply=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e.concat(Array.prototype.slice.call(arguments)))}};var x=function(t,e,n,r){var i=[];t(e,function(t,e){n(t,function(t,n){i=i.concat(n||[]),e(t)})},function(t){r(t,i)})};u.concat=y(x),u.concatSeries=v(x),u.whilst=function(t,e,n){t()?e(function(r){return r?n(r):void u.whilst(t,e,n)}):n()},u.doWhilst=function(t,e,n){t(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);e.apply(null,i)?u.doWhilst(t,e,n):n()})},u.until=function(t,e,n){t()?n():e(function(r){return r?n(r):void u.until(t,e,n)})},u.doUntil=function(t,e,n){t(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);e.apply(null,i)?n():u.doUntil(t,e,n)})},u.queue=function(t,e){function n(t,e,n,r){return t.started||(t.started=!0),c(e)||(e=[e]),0==e.length?u.setImmediate(function(){t.drain&&t.drain()}):void a(e,function(e){var i={data:e,callback:"function"==typeof r?r:null};n?t.tasks.unshift(i):t.tasks.push(i),t.saturated&&t.tasks.length===t.concurrency&&t.saturated(),u.setImmediate(t.process)})}void 0===e&&(e=1);var i=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(t,e){n(o,t,!1,e)},kill:function(){o.drain=null,o.tasks=[]},unshift:function(t,e){n(o,t,!0,e)},process:function(){if(!o.paused&&i<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),i+=1;var n=function(){i-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&o.tasks.length+i===0&&o.drain(),o.process()},u=r(n);t(e.data,u)}},length:function(){return o.tasks.length},running:function(){return i},idle:function(){return o.tasks.length+i===0},pause:function(){o.paused!==!0&&(o.paused=!0,o.process())},resume:function(){o.paused!==!1&&(o.paused=!1,o.process())}};return o},u.priorityQueue=function(t,e){function n(t,e){return t.priority-e.priority}function r(t,e,n){for(var r=-1,i=t.length-1;i>r;){var o=r+(i-r+1>>>1);n(e,t[o])>=0?r=o:i=o-1}return r}function i(t,e,i,o){return t.started||(t.started=!0),c(e)||(e=[e]),0==e.length?u.setImmediate(function(){t.drain&&t.drain()}):void a(e,function(e){var s={data:e,priority:i,callback:"function"==typeof o?o:null};t.tasks.splice(r(t.tasks,s,n)+1,0,s),t.saturated&&t.tasks.length===t.concurrency&&t.saturated(),u.setImmediate(t.process)})}var o=u.queue(t,e);return o.push=function(t,e,n){i(o,t,e,n)},delete o.unshift,o},u.cargo=function(t,e){var n=!1,r=[],i={tasks:r,payload:e,saturated:null,empty:null,drain:null,drained:!0,push:function(t,n){c(t)||(t=[t]),a(t,function(t){r.push({data:t,callback:"function"==typeof n?n:null}),i.drained=!1,i.saturated&&r.length===e&&i.saturated()}),u.setImmediate(i.process)},process:function o(){if(!n){if(0===r.length)return i.drain&&!i.drained&&i.drain(),void(i.drained=!0);var u="number"==typeof e?r.splice(0,e):r.splice(0,r.length),s=l(u,function(t){return t.data});i.empty&&i.empty(),n=!0,t(s,function(){n=!1;var t=arguments;a(u,function(e){e.callback&&e.callback.apply(null,t)}),o()})}},length:function(){return r.length},running:function(){return n}};return i};var S=function(t){return function(e){var n=Array.prototype.slice.call(arguments,1);e.apply(null,n.concat([function(e){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(e?console.error&&console.error(e):console[t]&&a(n,function(e){console[t](e)}))}]))}};u.log=S("log"),u.dir=S("dir"),u.memoize=function(t,e){var n={},r={};e=e||function(t){return t};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),s=e.apply(null,i);s in n?u.nextTick(function(){o.apply(null,n[s])}):s in r?r[s].push(o):(r[s]=[o],t.apply(null,i.concat([function(){n[s]=arguments;var t=r[s];delete r[s];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=t,i},u.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},u.times=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return u.map(r,e,n)},u.timesSeries=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return u.mapSeries(r,e,n)},u.seq=function(){var t=arguments;return function(){var e=this,n=Array.prototype.slice.call(arguments),r=n.pop();u.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}},u.compose=function(){return u.seq.apply(null,Array.prototype.reverse.call(arguments))};var L=function(t,e){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return t(e,function(t,e){t.apply(n,r.concat([e]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};u.applyEach=y(L),u.applyEachSeries=v(L),u.forever=function(t,e){function n(r){if(r){if(e)return e(r);throw r}t(n)}n()},"undefined"!=typeof n&&n.exports?n.exports=u:"undefined"!=typeof t&&t.amd?t([],function(){return u}):i.async=u}()}).call(this,e("_process"))},{_process:6}],4:[function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function u(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!i(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,i,s,c,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],u(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,s=new Array(i-1),c=1;i>c;c++)s[c-1]=arguments[c];n.apply(this,s)}else if(o(n)){for(i=arguments.length,s=new Array(i-1),c=1;i>c;c++)s[c-1]=arguments[c];for(a=n.slice(),i=a.length,c=0;i>c;c++)a[c].apply(this,s)}return!0},n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned){var i;i=u(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var i=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,i,u,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],u=n.length,i=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(s=u;s-->0;)if(n[s]===e||n[s].listener&&n[s].listener===e){i=s;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?r(t._events[e])?1:t._events[e].length:0}},{}],5:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],6:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],7:[function(t,e){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],8:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,t,r.depth)}function o(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function u(t){return t}function s(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function c(t,e,r){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return E(i)||(i=c(t,i,r)),i}var o=a(t,e);if(o)return o;var u=Object.keys(e),d=s(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(e)),L(e)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return l(e);if(0===u.length){if(A(e)){var v=e.name?": "+e.name:"";return t.stylize("[Function"+v+"]","special")}if(_(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(S(e))return t.stylize(Date.prototype.toString.call(e),"date");if(L(e))return l(e)}var m="",g=!1,w=["{","}"];if(y(e)&&(g=!0,w=["[","]"]),A(e)){var b=e.name?": "+e.name:"";m=" [Function"+b+"]"}if(_(e)&&(m=" "+RegExp.prototype.toString.call(e)),S(e)&&(m=" "+Date.prototype.toUTCString.call(e)),L(e)&&(m=" "+l(e)),0===u.length&&(!g||0==e.length))return w[0]+m+w[1];if(0>r)return _(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var x;return x=g?f(t,e,r,d,u):u.map(function(n){return p(t,e,r,d,n,g)}),t.seen.pop(),h(x,m,w)}function a(t,e){if(b(e))return t.stylize("undefined","undefined");if(E(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return g(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):v(e)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var o=[],u=0,s=e.length;s>u;++u)o.push(I(e,String(u))?p(t,e,n,r,String(u),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(t,e,n,r,i,!0))}),o}function p(t,e,n,r,i,o){var u,s,a;if(a=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},a.get?s=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(s=t.stylize("[Setter]","special")),I(r,i)||(u="["+i+"]"),s||(t.seen.indexOf(a.value)<0?(s=v(n)?c(t,a.value,null):c(t,a.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),b(u)){if(o&&i.match(/^\d+$/))return s;u=JSON.stringify(""+i),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function h(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function y(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function v(t){return null===t}function m(t){return null==t}function g(t){return"number"==typeof t}function E(t){return"string"==typeof t}function w(t){return"symbol"==typeof t}function b(t){return void 0===t}function _(t){return x(t)&&"[object RegExp]"===O(t)}function x(t){return"object"==typeof t&&null!==t}function S(t){return x(t)&&"[object Date]"===O(t)}function L(t){return x(t)&&("[object Error]"===O(t)||t instanceof Error)}function A(t){return"function"==typeof t}function k(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function O(t){return Object.prototype.toString.call(t)}function T(t){return 10>t?"0"+t.toString(10):t.toString(10)}function j(){var t=new Date,e=[T(t.getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":");return[t.getDate(),F[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!E(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(i(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,o=r.length,u=String(t).replace(D,function(t){if("%%"===t)return"%";if(n>=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return t}}),s=r[n];o>n;s=r[++n])u+=v(s)||!x(s)?" "+s:" "+i(s);return u},n.deprecate=function(t,i){function o(){if(!u){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),u=!0}return t.apply(this,arguments)}if(b(r.process))return function(){return n.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var u=!1;return o};var z,N={};n.debuglog=function(t){if(b(z)&&(z=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!N[t])if(new RegExp("\\b"+t+"\\b","i").test(z)){var r=e.pid;N[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else N[t]=function(){};return N[t]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=y,n.isBoolean=d,n.isNull=v,n.isNullOrUndefined=m,n.isNumber=g,n.isString=E,n.isSymbol=w,n.isUndefined=b,n.isRegExp=_,n.isObject=x,n.isDate=S,n.isError=L,n.isFunction=A,n.isPrimitive=k,n.isBuffer=t("./support/isBuffer");var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",j(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!x(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":7,_process:6,inherits:5}],9:[function(t,e,n){(function(t){function e(e){n.defer===!0?t.nextTick(e):e()}n.defer=!1,n.stringify=function(){var t=Array.prototype.slice.call(arguments),n=t.splice(t.length-1,t.length)[0];e(function(){try{return n(null,JSON.stringify.apply(null,t))}catch(e){return n(e,null)}})},n.parse=function(){var t=Array.prototype.slice.call(arguments),n=t.splice(t.length-1,t.length)[0];e(function(){try{return n(null,JSON.parse.apply(null,t))}catch(e){return n(e,null)}})}}).call(this,t("_process"))},{_process:6}]},{},[1])(1)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.ls=t()}}(function(){var t;return function e(t,n,r){function i(u,s){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(o)return o(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(t,e,n){"use strict";var r=t("./lib/LocalStorage");e.exports=new r,e.exports.getAdapter=function(t){var e=new r(t);return e}},{"./lib/LocalStorage":2}],2:[function(t,e,n){"use strict";function r(t){return t||function(){}}function i(t,e){return""===t?t.concat(e):t.concat(".").concat(e)}function o(t,e){e(null,t)}function u(t){if(a.EventEmitter.call(this),t&&"string"!=typeof t||(t={ns:t||""}),this.ns=t.ns||"","string"!=typeof this.ns)throw new Error("Namespace must be a string.");if(this.preSave=t.preSave||o,this.postLoad=t.postLoad||o,this.preSave&&"function"!=typeof this.preSave)throw new Error("preSave option must be a function");if(this.postLoad&&"function"!=typeof this.postLoad)throw new Error("postLoad option must be a function");this.EVENTS=p}var s=window.localStorage,c=t("safejson"),a=t("events"),l=t("async"),f=t("util"),p={SET:"SET",SET_FAILED:"SET_FAILED",GET:"GET",GET_FAILED:"GET_FAILED",REMOVE:"REMOVE",REMOVE_FAILED:"REMOVE_FAILED"};f.inherits(u,a.EventEmitter),e.exports=u,u.prototype.getNs=function(){return this.ns},u.prototype.getKeys=function(){var t=Object.keys(s),e=this.getNs().concat(".");return t.filter(function(t){return 0===t.indexOf(e)}).map(function(t){return t.replace(e,"")})},u.prototype.set=function(t,e,n){n=r(n);var o=this;this.preSave(e,function(r,u){if(r)n(r,null);else try{s.setItem(i(o.getNs(),t),u),n(null,null),o.emit(p.SET,t,e,u)}catch(c){n(c,null),o.emit(p.SET_FAILED,t,e,u)}})},u.prototype.setJson=function(t,e,n){var i=this;n=r(n),c.stringify(e,function(r,o){r?(n(r,null),i.emit(p.SET_FAILED,t,e)):i.set(t,o,n)})},u.prototype.get=function(t,e,n){e=r(e);var o=this;try{var u=s.getItem(i(this.getNs(),t));this.postLoad(u,function(r,i){e(r,i),n||o.emit(p.GET,t,u,i)})}catch(c){n||this.emit(p.GET_FAILED,t),e(c,null)}},u.prototype.clear=function(t){var e=this;l.eachSeries(this.getKeys(),function(t,n){e.remove(t,n)},function(e){t(e||null,null)})},u.prototype.getJson=function(t,e){e=r(e);var n=this;this.get(t,function(r,i){r?(e(r,null),n.emit(p.GET_FAILED,t)):c.parse(i,function(r,i){r?(e(r,null),n.emit(p.GET_FAILED,t)):(e(null,i),n.emit(p.GET,t,i))})},!0)},u.prototype.remove=function(t,e){e=r(e);try{s.removeItem(i(this.getNs(),t)),e(null,null),this.emit(p.REMOVE,t)}catch(n){e(n,null),this.emit(p.REMOVE_FAILED,t)}}},{async:3,events:4,safejson:9,util:8}],3:[function(e,n,r){(function(e){!function(){function r(t){var e=!1;return function(){if(e)throw new Error("Callback was already called.");e=!0,t.apply(i,arguments)}}var i,o,u={};i=this,null!=i&&(o=i.async),u.noConflict=function(){return i.async=o,u};var s=Object.prototype.toString,c=Array.isArray||function(t){return"[object Array]"===s.call(t)},a=function(t,e){for(var n=0;n<t.length;n+=1)e(t[n],n,t)},l=function(t,e){if(t.map)return t.map(e);var n=[];return a(t,function(t,r,i){n.push(e(t,r,i))}),n},f=function(t,e,n){return t.reduce?t.reduce(e,n):(a(t,function(t,r,i){n=e(n,t,r,i)}),n)},p=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e};"undefined"!=typeof e&&e.nextTick?(u.nextTick=e.nextTick,"undefined"!=typeof setImmediate?u.setImmediate=function(t){setImmediate(t)}:u.setImmediate=u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(t){setImmediate(t)},u.setImmediate=u.nextTick):(u.nextTick=function(t){setTimeout(t,0)},u.setImmediate=u.nextTick),u.each=function(t,e,n){function i(e){e?(n(e),n=function(){}):(o+=1,o>=t.length&&n())}if(n=n||function(){},!t.length)return n();var o=0;a(t,function(t){e(t,r(i))})},u.forEach=u.each,u.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n():i())})};i()},u.forEachSeries=u.eachSeries,u.eachLimit=function(t,e,n,r){var i=h(e);i.apply(null,[t,n,r])},u.forEachLimit=u.eachLimit;var h=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var i=0,o=0,u=0;!function s(){if(i>=e.length)return r();for(;t>u&&o<e.length;)o+=1,u+=1,n(e[o-1],function(t){t?(r(t),r=function(){}):(i+=1,u-=1,i>=e.length?r():s())})}()}},y=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[u.each].concat(e))}},v=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[h(t)].concat(n))}},d=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[u.eachSeries].concat(e))}},m=function(t,e,n,r){if(e=l(e,function(t,e){return{index:e,value:t}}),r){var i=[];t(e,function(t,e){n(t.value,function(n,r){i[t.index]=r,e(n)})},function(t){r(t,i)})}else t(e,function(t,e){n(t.value,function(t){e(t)})})};u.map=y(m),u.mapSeries=d(m),u.mapLimit=function(t,e,n,r){return g(e)(t,n,r)};var g=function(t){return v(t,m)};u.reduce=function(t,e,n,r){u.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(t,e,n,r){var i=l(t,function(t){return t}).reverse();u.reduce(i,e,n,r)},u.foldr=u.reduceRight;var w=function(t,e,n,r){var i=[];e=l(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&i.push(t),e()})},function(t){r(l(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};u.filter=y(w),u.filterSeries=d(w),u.select=u.filter,u.selectSeries=u.filterSeries;var E=function(t,e,n,r){var i=[];e=l(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||i.push(t),e()})},function(t){r(l(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};u.reject=y(E),u.rejectSeries=d(E);var b=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(t){r()})};u.detect=y(b),u.detectSeries=d(b),u.some=function(t,e,n){u.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},function(t){n(!1)})},u.any=u.some,u.every=function(t,e,n){u.each(t,function(t,r){e(t,function(t){t||(n(!1),n=function(){}),r()})},function(t){n(!0)})},u.all=u.every,u.sortBy=function(t,e,n){u.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);var r=function(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0};n(null,l(e.sort(r),function(t){return t.value}))})},u.auto=function(t,e){e=e||function(){};var n=p(t),r=n.length;if(!r)return e();var i={},o=[],s=function(t){o.unshift(t)},l=function(t){for(var e=0;e<o.length;e+=1)if(o[e]===t)return void o.splice(e,1)},h=function(){r--,a(o.slice(0),function(t){t()})};s(function(){if(!r){var t=e;e=function(){},t(null,i)}}),a(n,function(n){var r=c(t[n])?t[n]:[t[n]],o=function(t){var r=Array.prototype.slice.call(arguments,1);if(r.length<=1&&(r=r[0]),t){var o={};a(p(i),function(t){o[t]=i[t]}),o[n]=r,e(t,o),e=function(){}}else i[n]=r,u.setImmediate(h)},y=r.slice(0,Math.abs(r.length-1))||[],v=function(){return f(y,function(t,e){return t&&i.hasOwnProperty(e)},!0)&&!i.hasOwnProperty(n)};if(v())r[r.length-1](o,i);else{var d=function(){v()&&(l(d),r[r.length-1](o,i))};s(d)}})},u.retry=function(t,e,n){var r=5,i=[];"function"==typeof t&&(n=e,e=t,t=r),t=parseInt(t,10)||r;var o=function(r,o){for(var s=function(t,e){return function(n){t(function(t,r){n(!t||e,{err:t,result:r})},o)}};t;)i.push(s(e,!(t-=1)));u.series(i,function(t,e){e=e[e.length-1],(r||n)(e.err,e.result)})};return n?o():o},u.waterfall=function(t,e){if(e=e||function(){},!c(t)){var n=new Error("First argument to waterfall must be an array of functions");return e(n)}if(!t.length)return e();var r=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),o=t.next();o?i.push(r(o)):i.push(e),u.setImmediate(function(){t.apply(null,i)})}}};r(u.iterator(t))()};var _=function(t,e,n){if(n=n||function(){},c(e))t.map(e,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),e.call(null,t,n)})},n);else{var r={};t.each(p(e),function(t,n){e[t](function(e){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),r[t]=i,n(e)})},function(t){n(t,r)})}};u.parallel=function(t,e){_({map:u.map,each:u.each},t,e)},u.parallelLimit=function(t,e,n){_({map:g(e),each:h(e)},t,n)},u.series=function(t,e){if(e=e||function(){},c(t))u.mapSeries(t,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);n.length<=1&&(n=n[0]),e.call(null,t,n)})},e);else{var n={};u.eachSeries(p(t),function(e,r){t[e](function(t){var i=Array.prototype.slice.call(arguments,1);i.length<=1&&(i=i[0]),n[e]=i,r(t)})},function(t){e(t,n)})}},u.iterator=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return n<t.length-1?e(n+1):null},r};return e(0)},u.apply=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e.concat(Array.prototype.slice.call(arguments)))}};var x=function(t,e,n,r){var i=[];t(e,function(t,e){n(t,function(t,n){i=i.concat(n||[]),e(t)})},function(t){r(t,i)})};u.concat=y(x),u.concatSeries=d(x),u.whilst=function(t,e,n){t()?e(function(r){return r?n(r):void u.whilst(t,e,n)}):n()},u.doWhilst=function(t,e,n){t(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);e.apply(null,i)?u.doWhilst(t,e,n):n()})},u.until=function(t,e,n){t()?n():e(function(r){return r?n(r):void u.until(t,e,n)})},u.doUntil=function(t,e,n){t(function(r){if(r)return n(r);var i=Array.prototype.slice.call(arguments,1);e.apply(null,i)?n():u.doUntil(t,e,n)})},u.queue=function(t,e){function n(t,e,n,r){return t.started||(t.started=!0),c(e)||(e=[e]),0==e.length?u.setImmediate(function(){t.drain&&t.drain()}):void a(e,function(e){var i={data:e,callback:"function"==typeof r?r:null};n?t.tasks.unshift(i):t.tasks.push(i),t.saturated&&t.tasks.length===t.concurrency&&t.saturated(),u.setImmediate(t.process)})}void 0===e&&(e=1);var i=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(t,e){n(o,t,!1,e)},kill:function(){o.drain=null,o.tasks=[]},unshift:function(t,e){n(o,t,!0,e)},process:function(){if(!o.paused&&i<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),i+=1;var n=function(){i-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&o.tasks.length+i===0&&o.drain(),o.process()},u=r(n);t(e.data,u)}},length:function(){return o.tasks.length},running:function(){return i},idle:function(){return o.tasks.length+i===0},pause:function(){o.paused!==!0&&(o.paused=!0)},resume:function(){if(o.paused!==!1){o.paused=!1;for(var t=1;t<=o.concurrency;t++)u.setImmediate(o.process)}}};return o},u.priorityQueue=function(t,e){function n(t,e){return t.priority-e.priority}function r(t,e,n){for(var r=-1,i=t.length-1;i>r;){var o=r+(i-r+1>>>1);n(e,t[o])>=0?r=o:i=o-1}return r}function i(t,e,i,o){return t.started||(t.started=!0),c(e)||(e=[e]),0==e.length?u.setImmediate(function(){t.drain&&t.drain()}):void a(e,function(e){var s={data:e,priority:i,callback:"function"==typeof o?o:null};t.tasks.splice(r(t.tasks,s,n)+1,0,s),t.saturated&&t.tasks.length===t.concurrency&&t.saturated(),u.setImmediate(t.process)})}var o=u.queue(t,e);return o.push=function(t,e,n){i(o,t,e,n)},delete o.unshift,o},u.cargo=function(t,e){var n=!1,r=[],i={tasks:r,payload:e,saturated:null,empty:null,drain:null,drained:!0,push:function(t,n){c(t)||(t=[t]),a(t,function(t){r.push({data:t,callback:"function"==typeof n?n:null}),i.drained=!1,i.saturated&&r.length===e&&i.saturated()}),u.setImmediate(i.process)},process:function o(){if(!n){if(0===r.length)return i.drain&&!i.drained&&i.drain(),void(i.drained=!0);var u="number"==typeof e?r.splice(0,e):r.splice(0,r.length),s=l(u,function(t){return t.data});i.empty&&i.empty(),n=!0,t(s,function(){n=!1;var t=arguments;a(u,function(e){e.callback&&e.callback.apply(null,t)}),o()})}},length:function(){return r.length},running:function(){return n}};return i};var S=function(t){return function(e){var n=Array.prototype.slice.call(arguments,1);e.apply(null,n.concat([function(e){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(e?console.error&&console.error(e):console[t]&&a(n,function(e){console[t](e)}))}]))}};u.log=S("log"),u.dir=S("dir"),u.memoize=function(t,e){var n={},r={};e=e||function(t){return t};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),s=e.apply(null,i);s in n?u.nextTick(function(){o.apply(null,n[s])}):s in r?r[s].push(o):(r[s]=[o],t.apply(null,i.concat([function(){n[s]=arguments;var t=r[s];delete r[s];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=t,i},u.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},u.times=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return u.map(r,e,n)},u.timesSeries=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return u.mapSeries(r,e,n)},u.seq=function(){var t=arguments;return function(){var e=this,n=Array.prototype.slice.call(arguments),r=n.pop();u.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}},u.compose=function(){return u.seq.apply(null,Array.prototype.reverse.call(arguments))};var L=function(t,e){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return t(e,function(t,e){t.apply(n,r.concat([e]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};u.applyEach=y(L),u.applyEachSeries=d(L),u.forever=function(t,e){function n(r){if(r){if(e)return e(r);throw r}t(n)}n()},"undefined"!=typeof n&&n.exports?n.exports=u:"undefined"!=typeof t&&t.amd?t([],function(){return u}):i.async=u}()}).call(this,e("_process"))},{_process:6}],4:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function u(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,c,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),c=1;r>c;c++)o[c-1]=arguments[c];n.apply(this,o)}else if(u(n)){for(r=arguments.length,o=new Array(r-1),c=1;r>c;c++)o[c-1]=arguments[c];for(a=n.slice(),r=a.length,c=0;r>c;c++)a[c].apply(this,o)}return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?u(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,u(this._events[t])&&!this._events[t].warned){var n;n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(u(n)){for(s=o;s-->0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?i(t._events[e])?1:t._events[e].length:0}},{}],5:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],6:[function(t,e,n){function r(){}var i=e.exports={};i.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=r,i.addListener=r,i.once=r,i.off=r,i.removeListener=r,i.removeAllListeners=r,i.emit=r,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],7:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],8:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,t,r.depth)}function o(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function u(t,e){return t}function s(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function c(t,e,r){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return w(i)||(i=c(t,i,r)),i}var o=a(t,e);if(o)return o;var u=Object.keys(e),v=s(u);if(t.showHidden&&(u=Object.getOwnPropertyNames(e)),L(e)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return l(e);if(0===u.length){if(A(e)){var d=e.name?": "+e.name:"";return t.stylize("[Function"+d+"]","special")}if(_(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(S(e))return t.stylize(Date.prototype.toString.call(e),"date");if(L(e))return l(e)}var m="",g=!1,E=["{","}"];if(y(e)&&(g=!0,E=["[","]"]),A(e)){var b=e.name?": "+e.name:"";m=" [Function"+b+"]"}if(_(e)&&(m=" "+RegExp.prototype.toString.call(e)),S(e)&&(m=" "+Date.prototype.toUTCString.call(e)),L(e)&&(m=" "+l(e)),0===u.length&&(!g||0==e.length))return E[0]+m+E[1];if(0>r)return _(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var x;return x=g?f(t,e,r,v,u):u.map(function(n){return p(t,e,r,v,n,g)}),t.seen.pop(),h(x,m,E)}function a(t,e){if(b(e))return t.stylize("undefined","undefined");if(w(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return g(e)?t.stylize(""+e,"number"):v(e)?t.stylize(""+e,"boolean"):d(e)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,n,r,i){for(var o=[],u=0,s=e.length;s>u;++u)j(e,String(u))?o.push(p(t,e,n,r,String(u),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(t,e,n,r,i,!0))}),o}function p(t,e,n,r,i,o){var u,s,a;if(a=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},a.get?s=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(s=t.stylize("[Setter]","special")),j(r,i)||(u="["+i+"]"),s||(t.seen.indexOf(a.value)<0?(s=d(n)?c(t,a.value,null):c(t,a.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),b(u)){if(o&&i.match(/^\d+$/))return s;u=JSON.stringify(""+i),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function h(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function y(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function d(t){return null===t}function m(t){return null==t}function g(t){return"number"==typeof t}function w(t){return"string"==typeof t}function E(t){return"symbol"==typeof t}function b(t){return void 0===t}function _(t){return x(t)&&"[object RegExp]"===O(t)}function x(t){return"object"==typeof t&&null!==t}function S(t){return x(t)&&"[object Date]"===O(t)}function L(t){return x(t)&&("[object Error]"===O(t)||t instanceof Error)}function A(t){return"function"==typeof t}function k(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function O(t){return Object.prototype.toString.call(t)}function I(t){return 10>t?"0"+t.toString(10):t.toString(10)}function T(){var t=new Date,e=[I(t.getHours()),I(t.getMinutes()),I(t.getSeconds())].join(":");return[t.getDate(),F[t.getMonth()],e].join(" ")}function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/%[sdj%]/g;n.format=function(t){if(!w(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(i(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,o=r.length,u=String(t).replace(D,function(t){if("%%"===t)return"%";if(n>=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return t}}),s=r[n];o>n;s=r[++n])u+=d(s)||!x(s)?" "+s:" "+i(s);return u},n.deprecate=function(t,i){function o(){if(!u){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),u=!0}return t.apply(this,arguments)}if(b(r.process))return function(){return n.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var u=!1;return o};var z,N={};n.debuglog=function(t){if(b(z)&&(z=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!N[t])if(new RegExp("\\b"+t+"\\b","i").test(z)){var r=e.pid;N[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else N[t]=function(){};return N[t]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=y,n.isBoolean=v,n.isNull=d,n.isNullOrUndefined=m,n.isNumber=g,n.isString=w,n.isSymbol=E,n.isUndefined=b,n.isRegExp=_,n.isObject=x,n.isDate=S,n.isError=L,n.isFunction=A,n.isPrimitive=k,n.isBuffer=t("./support/isBuffer");var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",T(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!x(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":7,_process:6,inherits:5}],9:[function(t,e,n){(function(t){"use strict";function e(e){n.defer===!0?t.nextTick(e):e()}n.defer=!1,n.stringify=function(){var t=Array.prototype.slice.call(arguments),n=t.splice(t.length-1,t.length)[0];e(function(){try{return n(null,JSON.stringify.apply(null,t))}catch(e){return n(e,null)}})},n.parse=function(){var t=Array.prototype.slice.call(arguments),n=t.splice(t.length-1,t.length)[0];e(function(){try{return n(null,JSON.parse.apply(null,t))}catch(e){return n(e,null)}})}}).call(this,t("_process"))},{_process:6}]},{},[1])(1)});

@@ -7,6 +7,6 @@ 'use strict';

module.exports.getAdapter = function getAdapter (name) {
var adapter = new LS(name);
module.exports.getAdapter = function getAdapter (params) {
var adapter = new LS(params);
return adapter;
};

@@ -21,3 +21,3 @@ 'use strict';

browsers: ['Chrome'],
browsers: ['PhantomJS'],

@@ -24,0 +24,0 @@ singleRun: true

@@ -49,3 +49,12 @@ 'use strict';

/**
* Default drop in for processor hook for pre-save and post-load
* @param {String} v
* @param {Function} callback
*/
function defProcessor (v, callback) {
callback(null, v);
}
/**

@@ -55,7 +64,13 @@ * Class used to provide a wrapper over localStorage

*/
function LocalStorage (ns) {
function LocalStorage (params) {
events.EventEmitter.call(this);
this.ns = ns || '';
if (!params || typeof params === 'string') {
params = {
ns: params || ''
};
}
this.ns = params.ns || '';
if (typeof this.ns !== 'string') {

@@ -65,2 +80,13 @@ throw new Error('Namespace must be a string.');

this.preSave = params.preSave || defProcessor;
this.postLoad = params.postLoad || defProcessor;
if (this.preSave && typeof this.preSave !== 'function') {
throw new Error('preSave option must be a function');
}
if (this.postLoad && typeof this.postLoad !== 'function') {
throw new Error('postLoad option must be a function');
}
this.EVENTS = EVENTS;

@@ -107,11 +133,18 @@ }

callback = wrapCallback(callback);
var self = this;
try {
ls.setItem(genStorageKey(this.getNs(), key), value);
callback(null, null);
this.emit(EVENTS.SET, key, value);
} catch (e) {
callback(e, null);
this.emit(EVENTS.SET_FAILED, key, value);
}
this.preSave(value, function (err, newVal) {
if (err) {
callback(err, null);
} else {
try {
ls.setItem(genStorageKey(self.getNs(), key), newVal);
callback(null, null);
self.emit(EVENTS.SET, key, value, newVal);
} catch (e) {
callback(e, null);
self.emit(EVENTS.SET_FAILED, key, value, newVal);
}
}
});
};

@@ -150,10 +183,15 @@

var self = this;
// Pretty sure this doesn't throw, but let's be careful...
try {
var item = ls.getItem(genStorageKey(this.getNs(), key));
callback(null, item);
if (!silent) {
this.emit(EVENTS.GET, key, item);
}
this.postLoad(item, function (err, newVal) {
callback(err, newVal);
if (!silent) {
self.emit(EVENTS.GET, key, item, newVal);
}
});
} catch (e) {

@@ -173,3 +211,7 @@ if (!silent) {

LocalStorage.prototype.clear = function (callback) {
async.eachSeries(this.getKeys(), this.remove.bind(this), function (err) {
var self = this;
async.eachSeries(this.getKeys(), function (k, cb) {
self.remove(k, cb);
}, function (err) {
// Ensure error passed is null to keep with standards

@@ -176,0 +218,0 @@ callback(err || null, null);

{
"name": "browser-ls",
"version": "1.3.0",
"version": "1.4.0",
"description": "Tiny wrapper for localStorage (DOM Storage) that handles exceptions via callbacks",

@@ -9,2 +9,3 @@ "main": "./index.js",

},
"repository": "https://github.com/evanshortiss/browser-local-storage",
"keywords": [

@@ -35,5 +36,4 @@ "localStorage",

"sinon": "~1.11.1",
"karma-sinon": "~1.0.3",
"karma-chrome-launcher": "~0.1.5"
"karma-sinon": "~1.0.3"
}
}

@@ -5,3 +5,4 @@ browser-ls

[![build-status](https://travis-ci.org/evanshortiss/browser-local-storage.svg?branch=master)
](https://travis-ci.org/evanshortiss/browser-local-storage.svg?branch=master)
](https://travis-ci.org/evanshortiss/browser-local-storage.svg?branch=master)[![version](https://badge.fury.io/js/browser-ls.svg)
](https://badge.fury.io/js/browser-ls.svg)

@@ -166,2 +167,69 @@ browser-ls provides a nice node-like wrapper on the localStorage API in

Using a single instance to do this would have overwritten the Users value with
that of the plain ls interface.
that of the plain ls interface.
_getAdapter_ also has more advanced usage and supports pre-save and post-load
transforms. These are useful if you need to store encrypted data or performs
modification of data prior to saving. Here's an example"
```javascript
var ls = require('browser-ls');
var encryption = require('./encryption');
var userId = 'user-1234';
var Users = ls.getAdapter({
ns: 'Users', // Store data under this namespace
preSave: doEncrypt,
postLoad: doDecrypt
});
function doEncrypt (val, callback) {
// val is the value passed to the .set method below
encryption.encrypt(val, function (err, encryptedVal) {
if (err) {
callback(err, null);
} else {
// Send the updated value to the callback to be saved
callback(null, encryptedVal)
}
});
}
function doEncrypt (val, callback) {
// val is the value that the module got from localStorage
// in this case it is the encrypted value of:
// '{"name":"evan","location":"USA"}''
encryption.decrypt(val, function (err, decryptedVal) {
if (err) {
callback(err, null);
} else {
// Send the updated value to the callback to be loaded
callback(null, decryptedVal)
}
});
}
// This JSON string being saved will be encrypted by preSave
Users.set(userId, JSON.stringify({
name: 'evan',
location: 'USA'
}));
// The value we get will automatically be decrpyted
Users.get(userId, function (err, user) {
// user object will be equal to the originally saved data
});
```
In the above examples you could replace _set_ and _get_ with _setJson_ and
_getJson_ and the encryption would still work since the pre and post functions
are called directly before the safe after the JSON is stringified (set) and
before it's parsed (get).
## Changelog
#### 1.4.0
Added support for pre-save and post-load transforms.
#### pre 1.4.0
Not documented...

@@ -16,3 +16,8 @@ 'use strict';

// Remove everything from localStorage
Object.keys(window.localStorage).forEach(function (k) {
window.localStorage.removeItem(k);
});
describe('ls Module', function () {

@@ -150,2 +155,18 @@

});
it('Should modify the value before being set', function () {
var adp = window.ls.getAdapter({
preSave: function (val, callback) {
callback(null, val.replace('evan', ''));
}
});
adp.set(TEST_STR_KEY, 'evanshortiss', function (err) {
expect(err).to.be.null;
adp.get(TEST_STR_KEY, function (e, res) {
expect(e).to.be.null;
expect(res).to.equal('shortiss');
});
});
});
});

@@ -186,2 +207,18 @@

});
it ('Should modify an item during retreival', function () {
var adp = window.ls.getAdapter({
postLoad: function (val, callback) {
callback(null, val.replace('evan', ''));
}
});
adp.set(TEST_STR_KEY, 'evanshortiss', function (err) {
expect(err).to.be.null;
adp.get(TEST_STR_KEY, function (e, res) {
expect(e).to.be.null;
expect(res).to.equal('shortiss');
});
});
});
});

@@ -188,0 +225,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc