Comparing version 1.2.0 to 1.3.0
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.ls=e()}}(function(){return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!u&&c)return c(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t){"use strict";var n=e("./lib/LocalStorage");t.exports=new n,t.exports.getAdapter=function(e){return new n(e)}},{"./lib/LocalStorage":2}],2:[function(e,t){"use strict";function n(e){return e||function(){}}function r(e,t){return""===e?e.concat(t):e.concat(".").concat(t)}function i(e){if(u.EventEmitter.call(this),this.ns=e||"","string"!=typeof this.ns)throw new Error("Namespace must be a string.");this.EVENTS=l}var s=window.localStorage,o=e("safejson"),u=e("events"),c=e("util"),l={SET:"SET",SET_FAILED:"SET_FAILED",GET:"GET",GET_FAILED:"GET_FAILED",REMOVE:"REMOVE",REMOVE_FAILED:"REMOVE_FAILED"};c.inherits(i,u.EventEmitter),t.exports=i,i.prototype.getNs=function(){return this.ns},i.prototype.set=function(e,t,i){i=n(i);try{s.setItem(r(this.getNs(),e),t),i(null,null),this.emit(l.SET,e,t)}catch(o){i(o,null),this.emit(l.SET_FAILED,e,t)}},i.prototype.setJson=function(e,t,r){var i=this;r=n(r),o.stringify(t,function(n,s){n?(r(n,null),i.emit(l.SET_FAILED,e,t)):i.set(e,s,r)})},i.prototype.get=function(e,t,i){t=n(t);try{var o=s.getItem(r(this.getNs(),e));t(null,o),i||this.emit(l.GET,e,o)}catch(u){i||this.emit(l.GET_FAILED,e),t(u,null)}},i.prototype.getJson=function(e,t){t=n(t);var r=this;this.get(e,function(n,i){n?(t(n,null),r.emit(l.GET_FAILED,e)):o.parse(i,function(n,i){n?(t(n,null),r.emit(l.GET_FAILED,e)):(t(null,i),r.emit(l.GET,e,i))})},!0)},i.prototype.remove=function(e,t){t=n(t);try{s.removeItem(r(this.getNs(),e)),t(null,null),this.emit(l.REMOVE,e)}catch(i){t(i,null),this.emit(l.REMOVE_FAILED,e)}}},{events:3,safejson:8,util:7}],3:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,u,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],o(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,u=new Array(i-1),c=1;i>c;c++)u[c-1]=arguments[c];n.apply(this,u)}else if(s(n)){for(i=arguments.length,u=new Array(i-1),c=1;i>c;c++)u[c-1]=arguments[c];for(l=n.slice(),i=l.length,c=0;i>c;c++)l[c].apply(this,u)}return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var i;i=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,o,u;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(u=o;u-->0;)if(n[u]===t||n[u].listener&&n[u].listener===t){i=u;break}if(0>i)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?r(e._events[t])?1:e._events[t].length:0}},{}],4:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],5:[function(e,t){function n(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,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")}},{}],6:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],7:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(t)?r.showHidden=t:t&&n._extend(r,t),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),c(r,e,r.depth)}function s(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function o(e){return e}function u(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return _(i)||(i=c(e,i,r)),i}var s=l(e,t);if(s)return s;var o=Object.keys(t),v=u(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),O(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(t);if(0===o.length){if(S(t)){var d=t.name?": "+t.name:"";return e.stylize("[Function"+d+"]","special")}if(b(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(x(t))return e.stylize(Date.prototype.toString.call(t),"date");if(O(t))return f(t)}var y="",m=!1,E=["{","}"];if(g(t)&&(m=!0,E=["[","]"]),S(t)){var w=t.name?": "+t.name:"";y=" [Function"+w+"]"}if(b(t)&&(y=" "+RegExp.prototype.toString.call(t)),x(t)&&(y=" "+Date.prototype.toUTCString.call(t)),O(t)&&(y=" "+f(t)),0===o.length&&(!m||0==t.length))return E[0]+y+E[1];if(0>r)return b(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var L;return L=m?a(e,t,r,v,o):o.map(function(n){return p(e,t,r,v,n,m)}),e.seen.pop(),h(L,y,E)}function l(e,t){if(w(t))return e.stylize("undefined","undefined");if(_(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):d(t)?e.stylize("null","null"):void 0}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function a(e,t,n,r,i){for(var s=[],o=0,u=t.length;u>o;++o)s.push(N(t,String(o))?p(e,t,n,r,String(o),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||s.push(p(e,t,n,r,i,!0))}),s}function p(e,t,n,r,i,s){var o,u,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?u=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(u=e.stylize("[Setter]","special")),N(r,i)||(o="["+i+"]"),u||(e.seen.indexOf(l.value)<0?(u=d(n)?c(e,l.value,null):c(e,l.value,n-1),u.indexOf("\n")>-1&&(u=s?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),w(o)){if(s&&i.match(/^\d+$/))return u;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function h(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function d(e){return null===e}function y(e){return null==e}function m(e){return"number"==typeof e}function _(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function w(e){return void 0===e}function b(e){return L(e)&&"[object RegExp]"===A(e)}function L(e){return"object"==typeof e&&null!==e}function x(e){return L(e)&&"[object Date]"===A(e)}function O(e){return L(e)&&("[object Error]"===A(e)||e instanceof Error)}function S(e){return"function"==typeof e}function j(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function A(e){return Object.prototype.toString.call(e)}function D(e){return 10>e?"0"+e.toString(10):e.toString(10)}function T(){var e=new Date,t=[D(e.getHours()),D(e.getMinutes()),D(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var I=/%[sdj%]/g;n.format=function(e){if(!_(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,s=r.length,o=String(e).replace(I,function(e){if("%%"===e)return"%";if(n>=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),u=r[n];s>n;u=r[++n])o+=d(u)||!L(u)?" "+u:" "+i(u);return o},n.deprecate=function(e,i){function s(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}if(w(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var o=!1;return s};var z,F={};n.debuglog=function(e){if(w(z)&&(z=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!F[e])if(new RegExp("\\b"+e+"\\b","i").test(z)){var r=t.pid;F[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else F[e]=function(){};return F[e]},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=g,n.isBoolean=v,n.isNull=d,n.isNullOrUndefined=y,n.isNumber=m,n.isString=_,n.isSymbol=E,n.isUndefined=w,n.isRegExp=b,n.isObject=L,n.isDate=x,n.isError=O,n.isFunction=S,n.isPrimitive=j,n.isBuffer=e("./support/isBuffer");var M=["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=e("inherits"),n._extend=function(e,t){if(!t||!L(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":6,_process:5,inherits:4}],8:[function(e,t,n){(function(e){function t(t){n.defer===!0?e.nextTick(t):t()}n.defer=!1,n.stringify=function(){var e=Array.prototype.slice.call(arguments),n=e.splice(e.length-1,e.length)[0];t(function(){try{return n(null,JSON.stringify.apply(null,e))}catch(t){return n(t,null)}})},n.parse=function(){var e=Array.prototype.slice.call(arguments),n=e.splice(e.length-1,e.length)[0];t(function(){try{return n(null,JSON.parse.apply(null,e))}catch(t){return n(t,null)}})}}).call(this,e("_process"))},{_process:5}]},{},[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){"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)}); |
@@ -8,3 +8,5 @@ 'use strict'; | ||
module.exports.getAdapter = function getAdapter (name) { | ||
return new LS(name); | ||
var adapter = new LS(name); | ||
return adapter; | ||
}; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
browsers: ['PhantomJS', 'Chrome'], | ||
browsers: ['Chrome'], | ||
@@ -24,0 +24,0 @@ singleRun: true |
@@ -6,2 +6,3 @@ 'use strict'; | ||
, events = require('events') | ||
, async = require('async') | ||
, util = require('util'); | ||
@@ -79,2 +80,20 @@ | ||
/** | ||
* Get all keys in this adapter | ||
* @return {Array} | ||
*/ | ||
LocalStorage.prototype.getKeys = function () { | ||
var keys = Object.keys(ls) | ||
, ns = this.getNs().concat('.'); | ||
return keys | ||
.filter(function (k) { | ||
return (k.indexOf(ns) === 0); | ||
}) | ||
.map(function (k) { | ||
return k.replace(ns, ''); | ||
}); | ||
}; | ||
/** | ||
* Set a value in localStorage. | ||
@@ -147,2 +166,14 @@ * @param {String} key The under which data should be stored | ||
/** | ||
* Clear all stored keys for this instances namespace. | ||
* @param {Function} callback | ||
*/ | ||
LocalStorage.prototype.clear = function (callback) { | ||
async.eachSeries(this.getKeys(), this.remove.bind(this), function (err) { | ||
// Ensure error passed is null to keep with standards | ||
callback(err || null, null); | ||
}); | ||
}; | ||
/** | ||
* Useful method for getting JSON data directly as an object. | ||
@@ -149,0 +180,0 @@ * @param {String} key Key of Object to retrieve |
{ | ||
"name": "browser-ls", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Tiny wrapper for localStorage (DOM Storage) that handles exceptions via callbacks", | ||
@@ -19,3 +19,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"safejson": "~1.0.0" | ||
"safejson": "~1.0.0", | ||
"async": "~0.9.0" | ||
}, | ||
@@ -22,0 +23,0 @@ "devDependencies": { |
@@ -24,2 +24,5 @@ 'use strict'; | ||
beforeEach(function () { | ||
window.localStorage.clear(); | ||
}); | ||
@@ -107,2 +110,25 @@ describe('ls Object', function () { | ||
describe('#getKeys', function () { | ||
beforeEach(function () { | ||
window.localStorage.clear(); | ||
}); | ||
it('Should return an empty array', function () { | ||
var keys = ls.getAdapter('ABC').getKeys(); | ||
expect(keys).to.be.an('Array'); | ||
expect(keys).to.have.length(0); | ||
}); | ||
it('Should return a single key', function (done) { | ||
ls.getAdapter('ABC').set(TEST_STR, TEST_STR, function (err) { | ||
expect(err).to.be.null; | ||
var keys = ls.getAdapter('ABC').getKeys(); | ||
expect(keys).to.be.an('Array'); | ||
expect(keys).to.have.length(1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('#get', function () { | ||
@@ -162,3 +188,19 @@ it('Should try get an item not in localStorage', function () { | ||
describe('#clear', function () { | ||
it('Should clear keys that have been added', function (done) { | ||
var adapter = ls.getAdapter('Clear Test'); | ||
adapter.set(TEST_STR, TEST_STR, function (err) { | ||
expect(err).to.be.null; | ||
expect(adapter.getKeys()).to.have.length(1); | ||
adapter.clear(function (clearErr) { | ||
expect(clearErr).to.be.null; | ||
expect(adapter.getKeys()).to.have.length(0); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('#setJson', function () { | ||
@@ -165,0 +207,0 @@ it ('Should set a JSON object and retreive it', function () { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
113846
2545
2
+ Addedasync@~0.9.0
+ Addedasync@0.9.2(transitive)