Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update build

  • Loading branch information...
commit beaf1c06e258782d3d252b1a69d5dc1c256ae029 1 parent 73763a8
@ricardobeat authored
Showing with 261 additions and 123 deletions.
  1. +1 −1  dist/indexedup.min.js
  2. +260 −122 lib/indexedup.js
View
2  dist/indexedup.min.js
@@ -1 +1 @@
-(function(){var e=function(t,n){var r=e.resolve(t,n||"/"),i=e.modules[r];if(!i)throw new Error("Failed to resolve module "+t+", tried "+r);var s=e.cache[r],o=s?s.exports:i();return o};e.paths=[],e.modules={},e.cache={},e.extensions=[".js",".coffee",".json"],e._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},e.resolve=function(){return function(t,n){function u(t){t=r.normalize(t);if(e.modules[t])return t;for(var n=0;n<e.extensions.length;n++){var i=e.extensions[n];if(e.modules[t+i])return t+i}}function a(t){t=t.replace(/\/+$/,"");var n=r.normalize(t+"/package.json");if(e.modules[n]){var i=e.modules[n](),s=i.browserify;if(typeof s=="object"&&s.main){var o=u(r.resolve(t,s.main));if(o)return o}else if(typeof s=="string"){var o=u(r.resolve(t,s));if(o)return o}else if(i.main){var o=u(r.resolve(t,i.main));if(o)return o}}return u(t+"/index")}function f(e,t){var n=l(t);for(var r=0;r<n.length;r++){var i=n[r],s=u(i+"/"+e);if(s)return s;var o=a(i+"/"+e);if(o)return o}var s=u(e);if(s)return s}function l(e){var t;e==="/"?t=[""]:t=r.normalize(e).split("/");var n=[];for(var i=t.length-1;i>=0;i--){if(t[i]==="node_modules")continue;var s=t.slice(0,i+1).join("/")+"/node_modules";n.push(s)}return n}n||(n="/");if(e._core[t])return t;var r=e.modules.path();n=r.resolve("/",n);var i=n||"/";if(t.match(/^(?:\.\.?\/|\/)/)){var s=u(r.resolve(i,t))||a(r.resolve(i,t));if(s)return s}var o=f(t,i);if(o)return o;throw new Error("Cannot find module '"+t+"'")}}(),e.alias=function(t,n){var r=e.modules.path(),i=null;try{i=e.resolve(t+"/package.json","/")}catch(s){i=e.resolve(t,"/")}var o=r.dirname(i),u=(Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t})(e.modules);for(var a=0;a<u.length;a++){var f=u[a];if(f.slice(0,o.length+1)===o+"/"){var l=f.slice(o.length);e.modules[n+l]=e.modules[o+l]}else f===o&&(e.modules[n]=e.modules[o])}},function(){var t={},n=typeof window!="undefined"?window:{},r=!1;e.define=function(i,s){!r&&e.modules.__browserify_process&&(t=e.modules.__browserify_process(),r=!0);var o=e._core[i]?"":e.modules.path().dirname(i),u=function(t){var n=e(t,o),r=e.cache[e.resolve(t,o)];return r&&r.parent===null&&(r.parent=a),n};u.resolve=function(t){return e.resolve(t,o)},u.modules=e.modules,u.define=e.define,u.cache=e.cache;var a={id:i,filename:i,exports:{},loaded:!1,parent:null};e.modules[i]=function(){return e.cache[i]=a,s.call(a.exports,u,a,a.exports,o,i,t,n),a.loaded=!0,a.exports}}}(),e.define("path",function(e,t,n,r,i,s,o){function u(e,t){var n=[];for(var r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}function a(e,t){var n=0;for(var r=e.length;r>=0;r--){var i=e[r];i=="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var f=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){var e="",t=!1;for(var n=arguments.length;n>=-1&&!t;n--){var r=n>=0?arguments[n]:s.cwd();if(typeof r!="string"||!r)continue;e=r+"/"+e,t=r.charAt(0)==="/"}return e=a(u(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."},n.normalize=function(e){var t=e.charAt(0)==="/",n=e.slice(-1)==="/";return e=a(u(e.split("/"),function(e){return!!e}),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(u(e,function(e,t){return e&&typeof e=="string"}).join("/"))},n.dirname=function(e){var t=f.exec(e)[1]||"",n=!1;return t?t.length===1||n&&t.length<=3&&t.charAt(1)===":"?t:t.substring(0,t.length-1):"."},n.basename=function(e,t){var n=f.exec(e)[2]||"";return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return f.exec(e)[3]||""}}),e.define("__browserify_process",function(e,t,n,r,i,s,o){var s=t.exports={};s.nextTick=function(){var e=typeof window!="undefined"&&window.setImmediate,t=typeof window!="undefined"&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){if(e.source===window&&e.data==="browserify-tick"){e.stopPropagation();if(n.length>0){var t=n.shift();t()}}},!0),function(t){n.push(t),window.postMessage("browserify-tick","*")}}return function(t){setTimeout(t,0)}}(),s.title="browser",s.browser=!0,s.env={},s.argv=[],s.binding=function(t){if(t==="evals")return e("vm");throw new Error("No such module. (Possibly not yet loaded)")},function(){var t="/",n;s.cwd=function(){return t},s.chdir=function(r){n||(n=e("path")),t=n.resolve(r,t)}}()}),e.define("stream",function(e,t,n,r,i,s,o){function f(){u.EventEmitter.call(this)}var u=e("events"),a=e("util");a.inherits(f,u.EventEmitter),t.exports=f,f.Stream=f,f.prototype.pipe=function(e,t){function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}function o(){if(s)return;s=!0,e._pipeCount--,f();if(e._pipeCount>0)return;e.end()}function u(){if(s)return;s=!0,e._pipeCount--,f();if(e._pipeCount>0)return;e.destroy()}function a(e){f();if(this.listeners("error").length===0)throw e}function f(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",o),n.removeListener("close",u),n.removeListener("error",a),e.removeListener("error",a),n.removeListener("end",f),n.removeListener("close",f),e.removeListener("end",f),e.removeListener("close",f)}var n=this;n.on("data",r),e.on("drain",i),!e._isStdio&&(!t||t.end!==!1)&&(e._pipeCount=e._pipeCount||0,e._pipeCount++,n.on("end",o),n.on("close",u));var s=!1;return n.on("error",a),e.on("error",a),n.on("end",f),n.on("close",f),e.on("end",f),e.on("close",f),e.emit("pipe",n),e}}),e.define("events",function(e,t,n,r,i,s,o){s.EventEmitter||(s.EventEmitter=function(){});var u=n.EventEmitter=s.EventEmitter,a=typeof Array.isArray=="function"?Array.isArray:function(e){return Object.prototype.toString.call(e)==="[object Array]"},f=10;u.prototype.setMaxListeners=function(e){this._events||(this._events={}),this._events.maxListeners=e},u.prototype.emit=function(e){if(e==="error")if(!this._events||!this._events.error||a(this._events.error)&&!this._events.error.length)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var t=this._events[e];if(!t)return!1;if(typeof t=="function"){switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:var n=Array.prototype.slice.call(arguments,1);t.apply(this,n)}return!0}if(a(t)){var n=Array.prototype.slice.call(arguments,1),r=t.slice();for(var i=0,s=r.length;i<s;i++)r[i].apply(this,n);return!0}return!1},u.prototype.addListener=function(e,t){if("function"!=typeof t)throw new Error("addListener only takes instances of Function");this._events||(this._events={}),this.emit("newListener",e,t);if(!this._events[e])this._events[e]=t;else if(a(this._events[e])){if(!this._events[e].warned){var n;this._events.maxListeners!==undefined?n=this._events.maxListeners:n=f,n&&n>0&&this._events[e].length>n&&(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),console.trace())}this._events[e].push(t)}else this._events[e]=[this._events[e],t];return this},u.prototype.on=u.prototype.addListener,u.prototype.once=function(e,t){var n=this;return n.on(e,function r(){n.removeListener(e,r),t.apply(this,arguments)}),this},u.prototype.removeListener=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[e])return this;var n=this._events[e];if(a(n)){var r=n.indexOf(t);if(r<0)return this;n.splice(r,1),n.length==0&&delete this._events[e]}else this._events[e]===t&&delete this._events[e];return this},u.prototype.removeAllListeners=function(e){return e&&this._events&&this._events[e]&&(this._events[e]=null),this},u.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}}),e.define("util",function(e,t,n,r,i,s,o){function a(e){return e instanceof Array||Array.isArray(e)||e&&e!==Object.prototype&&a(e.__proto__)}function f(e){return e instanceof RegExp||typeof e=="object"&&Object.prototype.toString.call(e)==="[object RegExp]"}function l(e){if(e instanceof Date)return!0;if(typeof e!="object")return!1;var t=Date.prototype&&v(Date.prototype),n=e.__proto__&&v(e.__proto__);return JSON.stringify(n)===JSON.stringify(t)}function c(e){return e<10?"0"+e.toString(10):e.toString(10)}function p(){var e=new Date,t=[c(e.getHours()),c(e.getMinutes()),c(e.getSeconds())].join(":");return[e.getDate(),h[e.getMonth()],t].join(" ")}var u=e("events");n.print=function(){},n.puts=function(){},n.debug=function(){},n.inspect=function(e,t,r,i){function u(e,r){if(e&&typeof e.inspect=="function"&&e!==n&&(!e.constructor||e.constructor.prototype!==e))return e.inspect(r);switch(typeof e){case"undefined":return o("undefined","undefined");case"string":var i="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return o(i,"string");case"number":return o(""+e,"number");case"boolean":return o(""+e,"boolean")}if(e===null)return o("null","null");var c=d(e),h=t?v(e):c;if(typeof e=="function"&&h.length===0){if(f(e))return o(""+e,"regexp");var p=e.name?": "+e.name:"";return o("[Function"+p+"]","special")}if(l(e)&&h.length===0)return o(e.toUTCString(),"date");var m,g,y;a(e)?(g="Array",y=["[","]"]):(g="Object",y=["{","}"]);if(typeof e=="function"){var b=e.name?": "+e.name:"";m=f(e)?" "+e:" [Function"+b+"]"}else m="";l(e)&&(m=" "+e.toUTCString());if(h.length===0)return y[0]+m+y[1];if(r<0)return f(e)?o(""+e,"regexp"):o("[Object]","special");s.push(e);var w=h.map(function(t){var n,i;e.__lookupGetter__&&(e.__lookupGetter__(t)?e.__lookupSetter__(t)?i=o("[Getter/Setter]","special"):i=o("[Getter]","special"):e.__lookupSetter__(t)&&(i=o("[Setter]","special"))),c.indexOf(t)<0&&(n="["+t+"]"),i||(s.indexOf(e[t])<0?(r===null?i=u(e[t]):i=u(e[t],r-1),i.indexOf("\n")>-1&&(a(e)?i=i.split("\n").map(function(e){return" "+e}).join("\n").substr(2):i="\n"+i.split("\n").map(function(e){return" "+e}).join("\n"))):i=o("[Circular]","special"));if(typeof n=="undefined"){if(g==="Array"&&t.match(/^\d+$/))return i;n=JSON.stringify(""+t),n.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(n=n.substr(1,n.length-2),n=o(n,"name")):(n=n.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),n=o(n,"string"))}return n+": "+i});s.pop();var E=0,S=w.reduce(function(e,t){return E++,t.indexOf("\n")>=0&&E++,e+t.length+1},0);return S>50?w=y[0]+(m===""?"":m+"\n ")+" "+w.join(",\n ")+" "+y[1]:w=y[0]+m+" "+w.join(", ")+" "+y[1],w}var s=[],o=function(e,t){var n={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]},r={special:"cyan",number:"blue","boolean":"yellow","undefined":"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[t];return r?"["+n[r][0]+"m"+e+"["+n[r][1]+"m":e};return i||(o=function(e,t){return e}),u(e,typeof r=="undefined"?2:r)};var h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(e){},n.pump=null;var d=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},v=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.hasOwnProperty.call(e,n)&&t.push(n);return t},m=Object.create||function(e,t){var n;if(e===null)n={__proto__:null};else{if(typeof e!="object")throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return typeof t!="undefined"&&Object.defineProperties&&Object.defineProperties(n,t),n};n.inherits=function(e,t){e.super_=t,e.prototype=m(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})};var g=/%[sdj%]/g;n.format=function(e){if(typeof e!="string"){var t=[];for(var r=0;r<arguments.length;r++)t.push(n.inspect(arguments[r]));return t.join(" ")}var r=1,i=arguments,s=i.length,o=String(e).replace(g,function(e){if(e==="%%")return"%";if(r>=s)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":return JSON.stringify(i[r++]);default:return e}});for(var u=i[r];r<s;u=i[++r])u===null||typeof u!="object"?o+=" "+u:o+=" "+n.inspect(u);return o}}),e.define("/src/errors.coffee",function(e,t,n,r,i,s,o){(function(){var n,r;r=e("errno"),n=r.custom.createError("LevelUPError"),t.exports={LevelUPError:n,InitializationError:r.custom.createError("InitializationError",n),OpenError:r.custom.createError("OpenError",n),ReadError:r.custom.createError("ReadError",n),WriteError:r.custom.createError("WriteError",n),NotFoundError:r.custom.createError("NotFoundError",n),CloseError:r.custom.createError("CloseError",n)}}).call(this)}),e.define("/node_modules/errno/package.json",function(e,t,n,r,i,s,o){t.exports={main:"errno.js"}}),e.define("/node_modules/errno/errno.js",function(e,t,n,r,i,s,o){var u=t.exports.all=[{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"no more processes"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:""},{errno:7,code:"EAFNOSUPPORT",description:""},{errno:8,code:"EALREADY",description:""},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:""},{errno:42,code:"EAIFAMNOSUPPORT",description:""},{errno:44,code:"EAISERVICE",description:""},{errno:45,code:"EAISOCKTYPE",description:""},{errno:46,code:"ESHUTDOWN",description:""},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];t.exports.errno={"-1":u[0],0:u[1],1:u[2],2:u[3],3:u[4],4:u[5],5:u[6],6:u[7],7:u[8],8:u[9],9:u[10],10:u[11],11:u[12],12:u[13],13:u[14],14:u[15],15:u[16],16:u[17],17:u[18],18:u[19],19:u[20],20:u[21],21:u[22],22:u[23],23:u[24],24:u[25],25:u[26],26:u[27],27:u[28],28:u[29],29:u[30],31:u[31],32:u[32],33:u[33],34:u[34],35:u[35],36:u[36],37:u[37],38:u[38],39:u[39],40:u[40],41:u[41],42:u[42],44:u[43],45:u[44],46:u[45],47:u[46],48:u[47],49:u[48],50:u[49],51:u[50],52:u[51],53:u[52],54:u[53],55:u[54],56:u[55],57:u[56],58:u[57],59:u[58]},t.exports.code={UNKNOWN:u[0],OK:u[1],EOF:u[2],EADDRINFO:u[3],EACCES:u[4],EAGAIN:u[5],EADDRINUSE:u[6],EADDRNOTAVAIL:u[7],EAFNOSUPPORT:u[8],EALREADY:u[9],EBADF:u[10],EBUSY:u[11],ECONNABORTED:u[12],ECONNREFUSED:u[13],ECONNRESET:u[14],EDESTADDRREQ:u[15],EFAULT:u[16],EHOSTUNREACH:u[17],EINTR:u[18],EINVAL:u[19],EISCONN:u[20],EMFILE:u[21],EMSGSIZE:u[22],ENETDOWN:u[23],ENETUNREACH:u[24],ENFILE:u[25],ENOBUFS:u[26],ENOMEM:u[27],ENOTDIR:u[28],EISDIR:u[29],ENONET:u[30],ENOTCONN:u[31],ENOTSOCK:u[32],ENOTSUP:u[33],ENOENT:u[34],ENOSYS:u[35],EPIPE:u[36],EPROTO:u[37],EPROTONOSUPPORT:u[38],EPROTOTYPE:u[39],ETIMEDOUT:u[40],ECHARSET:u[41],EAIFAMNOSUPPORT:u[42],EAISERVICE:u[43],EAISOCKTYPE:u[44],ESHUTDOWN:u[45],EEXIST:u[46],ESRCH:u[47],ENAMETOOLONG:u[48],EPERM:u[49],ELOOP:u[50],EXDEV:u[51],ENOTEMPTY:u[52],ENOSPC:u[53],EIO:u[54],EROFS:u[55],ENODEV:u[56],ESPIPE:u[57],ECANCELED:u[58]},t.exports.custom=e("./custom")(t.exports)}),e.define("/node_modules/errno/custom.js",function(e,t,n,r,i,s,o){function u(e,t,n){this.name=e,this.cause=typeof t!="string"?t:n,this.message=!t||typeof t=="string"?t:t.message}function a(e,t){Error.call(this),Error.captureStackTrace(this,arguments.callee),u.call(this,"CustomError",e,t)}function f(e,t,n){var r=function(n,r){u.call(this,t,n,r),t=="FilesystemError"&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace(this,arguments.callee)};return r.prototype=n?new n:new a,r}a.prototype=new Error,t.exports=function(e){var t=f.bind(null,e);return{CustomError:a,FilesystemError:t("FilesystemError"),createError:t}}}),e.define("/src/indexedup.js",function(e,t,n,r,i,s,o){function h(e){this.idb=e,this.readable=!0,s.nextTick(this.init.bind(this))}function p(e,t){if(t)return t(e);throw e}function d(e,t){t==null&&(t={});if(typeof e!="string")return err=new a.InitializationError("Must provide a location for the database"),p(err);this._options={createIfMissing:t.createIfMissing||!1,errorIfExists:t.errorIfExists||!1,encoding:t.encoding||"json",sync:!1},this.storename="indexedup",this._location=e,this._status="new"}function v(e,t,n){return typeof t=="function"&&(n=t,t=null),newdb=new d(e,t),newdb.open(n)}__extends=function(e,t){function r(){this.constructor=e}for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};var u=e("stream"),a=e("./errors"),f=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.oIndexedDB,l=window.IDBTransaction||window.mozIDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction||window.oIndexedDB,c=window.IDBKeyRange||window.mozIDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange||window.oIDBKeyRange;__extends(h,u.Stream),h.prototype.init=function(){var e=this,t=this.idb.db.transaction([this.idb.storename],"readonly"),n=t.objectStore(this.idb.storename),r=c.lowerBound(0);return req=n.openCursor(r),req.onsuccess=function(t){var n=t.target.result;if(!n)return;return e.emit("data",n.value),n["continue"]()},req.onerror=function(t){return e.emit("error",t)},t.oncomplete=function(){return e.end()}},h.prototype.write=function(e,t){this.emit("data",e)},h.prototype.end=function(){this.emit("end")},d.prototype.open=function(e){function r(t){var t=null;try{t=this.getStore(!0)}catch(n){}return this._options.errorIfExists===!0&&t!=null?(err=new a.OpenError("Database already exists (errorIfExists: true)"),p(err,e),!0):this._options.createIfMissing===!1&&!t?(err=new a.OpenError("Database doesn't exist (createIfMissing: false)"),p(err,e),!0):(r=function(){},!1)}var t=this,n=f.open(this._location);n.onsuccess=function(i){t.db=n.result;if(r.call(_this))return;typeof e=="function"&&e(null,t),t._status="open"},n.onupgradeneeded=function(e){if(r.call(_this))return;var n=e.target.result;t.store=n.createObjectStore(_this.storename,{keyPath:"key"})},n.onerror=function(t){var n=new a.OpenError(t);return p(n,e)}},d.prototype.close=function(e){return this.isOpen()?(this.db=null,this._status="closed",e()):(err=new a.CloseError("Cannot close unopened database"),p(err,e))},d.prototype.isOpen=function(){return this._status==="open"},d.prototype.isClosed=function(){return this._status==="closed"},d.prototype.getTransaction=function(e){var t=e?"readwrite":"readonly";return this.db.transaction([this.storename],t)},d.prototype.getStore=function(e,t){return t==null&&(t=this.getTransaction(e)),t.objectStore(this.storename)},d.prototype.put=function(e,t,n,r){typeof n=="function"&&(r=n,n=null);if(!this.isOpen()){var i=new a.WriteError("Database has not been opened");return p(i,r)}if(e==null){var i=new a.WriteError("Invalid key");return p(i,r)}if(t==null){var i=new a.WriteError("Invalid data");return p(i,r)}req=this.getStore(!0).put({key:e,value:t}),req.onsuccess=function(e){return typeof r=="function"?r(null,req.result):void 0},req.onerror=function(e){return i=new a.WriteError(e),p(i,r)}},d.prototype.get=function(e,t,n){typeof t=="function"&&(n=t,t=n);if(!this.isOpen()){var r=new a.ReadError("Database has not been opened");return p(r,n)}if(e==null){var r=new a.ReadError("Invalid key");return p(r,n)}req=this.getStore().get(e),req.onsuccess=function(e){var t=req.result;typeof req.result!="undefined"&&typeof n=="function"?n(null,req.result.value):req.onerror()},req.onerror=function(t){var t=new a.NotFoundError("Key not found in database ["+e+"]");return p(t,n)}},d.prototype.del=function(e,t,n){typeof t=="function"&&(n=t,t=n);if(!this.isOpen()){var r=new a.WriteError("Database has not been opened");return p(r,n)}if(e==null){var r=new a.WriteError("Invalid key");return p(r,n)}req=this.getStore(!0)["delete"](e),req.onsuccess=function(e){typeof n=="function"&&n(null,req.result)},req.onerror=function(e){var t=new a.WriteError(e);if(typeof n=="function")return n(t);throw t}},d.prototype.batch=function(e,t){if(!this.isOpen()){var n=new a.WriteError("Database has not been opened");return p(n,t)}var r=this.getTransaction(!0),i=this.getStore(null,r);for(_i=0,_len=e.length;_i<_len;_i++){op=e[_i];if(op.type==null||op.key==null)continue;switch(op.type){case"put":i.put({key:op.key,value:op.value});break;case"get":i.delete(op.key)}}r.oncomplete=function(e){typeof t=="function"&&t()},r.onerror=function(e){var n=new a.WriteError(e);return p(n,t)}},d.prototype.readStream=function(){return new h(this)},(typeof t!="undefined"&&t!==null?t.exports:void 0)?t.exports=v:window.indexedup=v}),e("/src/indexedup.js")})()
+(function(){var e=function(r,t){var n=e.resolve(r,t||"/"),o=e.modules[n];if(!o)throw Error("Failed to resolve module "+r+", tried "+n);var i=e.cache[n],s=i?i.exports:o();return s};e.paths=[],e.modules={},e.cache={},e.extensions=[".js",".coffee",".json"],e._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},e.resolve=function(){return function(r,t){function n(r){if(r=c.normalize(r),e.modules[r])return r;for(var t=0;e.extensions.length>t;t++){var n=e.extensions[t];if(e.modules[r+n])return r+n}}function o(r){r=r.replace(/\/+$/,"");var t=c.normalize(r+"/package.json");if(e.modules[t]){var o=e.modules[t](),i=o.browserify;if("object"==typeof i&&i.main){var s=n(c.resolve(r,i.main));if(s)return s}else if("string"==typeof i){var s=n(c.resolve(r,i));if(s)return s}else if(o.main){var s=n(c.resolve(r,o.main));if(s)return s}}return n(r+"/index")}function i(e,r){for(var t=s(r),i=0;t.length>i;i++){var c=t[i],a=n(c+"/"+e);if(a)return a;var u=o(c+"/"+e);if(u)return u}var a=n(e);return a?a:void 0}function s(e){var r;r="/"===e?[""]:c.normalize(e).split("/");for(var t=[],n=r.length-1;n>=0;n--)if("node_modules"!==r[n]){var o=r.slice(0,n+1).join("/")+"/node_modules";t.push(o)}return t}if(t||(t="/"),e._core[r])return r;var c=e.modules.path();t=c.resolve("/",t);var a=t||"/";if(r.match(/^(?:\.\.?\/|\/)/)){var u=n(c.resolve(a,r))||o(c.resolve(a,r));if(u)return u}var d=i(r,a);if(d)return d;throw Error("Cannot find module '"+r+"'")}}(),e.alias=function(r,t){var n=e.modules.path(),o=null;try{o=e.resolve(r+"/package.json","/")}catch(i){o=e.resolve(r,"/")}for(var s=n.dirname(o),c=(Object.keys||function(e){var r=[];for(var t in e)r.push(t);return r})(e.modules),a=0;c.length>a;a++){var u=c[a];if(u.slice(0,s.length+1)===s+"/"){var d=u.slice(s.length);e.modules[t+d]=e.modules[s+d]}else u===s&&(e.modules[t]=e.modules[s])}},function(){var r={},t="undefined"!=typeof window?window:{},n=!1;e.define=function(o,i){!n&&e.modules.__browserify_process&&(r=e.modules.__browserify_process(),n=!0);var s=e._core[o]?"":e.modules.path().dirname(o),c=function(r){var t=e(r,s),n=e.cache[e.resolve(r,s)];return n&&null===n.parent&&(n.parent=a),t};c.resolve=function(r){return e.resolve(r,s)},c.modules=e.modules,c.define=e.define,c.cache=e.cache;var a={id:o,filename:o,exports:{},loaded:!1,parent:null};e.modules[o]=function(){return e.cache[o]=a,i.call(a.exports,c,a,a.exports,s,o,r,t),a.loaded=!0,a.exports}}}(),e.define("path",function(e,r,t,n,o,i){function s(e,r){for(var t=[],n=0;e.length>n;n++)r(e[n],n,e)&&t.push(e[n]);return t}function c(e,r){for(var t=0,n=e.length;n>=0;n--){var o=e[n];"."==o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t--;t)e.unshift("..");return e}var a=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;t.resolve=function(){for(var e="",r=!1,t=arguments.length;t>=-1&&!r;t--){var n=t>=0?arguments[t]:i.cwd();"string"==typeof n&&n&&(e=n+"/"+e,r="/"===n.charAt(0))}return e=c(s(e.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+e||"."},t.normalize=function(e){var r="/"===e.charAt(0),t="/"===e.slice(-1);return e=c(s(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(s(e,function(e){return e&&"string"==typeof e}).join("/"))},t.dirname=function(e){var r=a.exec(e)[1]||"",t=!1;return r?1===r.length||t&&3>=r.length&&":"===r.charAt(1)?r:r.substring(0,r.length-1):"."},t.basename=function(e,r){var t=a.exec(e)[2]||"";return r&&t.substr(-1*r.length)===r&&(t=t.substr(0,t.length-r.length)),t},t.extname=function(e){return a.exec(e)[3]||""}}),e.define("__browserify_process",function(e,r,t,n,o,i){var i=r.exports={};i.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,r="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(r){var t=[];return window.addEventListener("message",function(e){if(e.source===window&&"browserify-tick"===e.data&&(e.stopPropagation(),t.length>0)){var r=t.shift();r()}},!0),function(e){t.push(e),window.postMessage("browserify-tick","*")}}return function(e){setTimeout(e,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.binding=function(r){if("evals"===r)return e("vm");throw Error("No such module. (Possibly not yet loaded)")},function(){var r,t="/";i.cwd=function(){return t},i.chdir=function(n){r||(r=e("path")),t=r.resolve(n,t)}}()}),e.define("stream",function(e,r){function t(){n.EventEmitter.call(this)}var n=e("events"),o=e("util");o.inherits(t,n.EventEmitter),r.exports=t,t.Stream=t,t.prototype.pipe=function(e,r){function t(r){e.writable&&!1===e.write(r)&&a.pause&&a.pause()}function n(){a.readable&&a.resume&&a.resume()}function o(){u||(u=!0,e._pipeCount--,c(),e._pipeCount>0||e.end())}function i(){u||(u=!0,e._pipeCount--,c(),e._pipeCount>0||e.destroy())}function s(e){if(c(),0===this.listeners("error").length)throw e}function c(){a.removeListener("data",t),e.removeListener("drain",n),a.removeListener("end",o),a.removeListener("close",i),a.removeListener("error",s),e.removeListener("error",s),a.removeListener("end",c),a.removeListener("close",c),e.removeListener("end",c),e.removeListener("close",c)}var a=this;a.on("data",t),e.on("drain",n),e._isStdio||r&&r.end===!1||(e._pipeCount=e._pipeCount||0,e._pipeCount++,a.on("end",o),a.on("close",i));var u=!1;return a.on("error",s),e.on("error",s),a.on("end",c),a.on("close",c),e.on("end",c),e.on("close",c),e.emit("pipe",a),e}}),e.define("events",function(e,r,t,n,o,i){i.EventEmitter||(i.EventEmitter=function(){});var s=t.EventEmitter=i.EventEmitter,c="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=10;s.prototype.setMaxListeners=function(e){this._events||(this._events={}),this._events.maxListeners=e},s.prototype.emit=function(e){if("error"===e&&(!this._events||!this._events.error||c(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var r=this._events[e];if(!r)return!1;if("function"==typeof r){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:var t=Array.prototype.slice.call(arguments,1);r.apply(this,t)}return!0}if(c(r)){for(var t=Array.prototype.slice.call(arguments,1),n=r.slice(),o=0,i=n.length;i>o;o++)n[o].apply(this,t);return!0}return!1},s.prototype.addListener=function(e,r){if("function"!=typeof r)throw Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",e,r),this._events[e])if(c(this._events[e])){if(!this._events[e].warned){var t;t=void 0!==this._events.maxListeners?this._events.maxListeners:a,t&&t>0&&this._events[e].length>t&&(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),console.trace())}this._events[e].push(r)}else this._events[e]=[this._events[e],r];else this._events[e]=r;return this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,r){var t=this;return t.on(e,function n(){t.removeListener(e,n),r.apply(this,arguments)}),this},s.prototype.removeListener=function(e,r){if("function"!=typeof r)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[e])return this;var t=this._events[e];if(c(t)){var n=t.indexOf(r);if(0>n)return this;t.splice(n,1),0==t.length&&delete this._events[e]}else this._events[e]===r&&delete this._events[e];return this},s.prototype.removeAllListeners=function(e){return e&&this._events&&this._events[e]&&(this._events[e]=null),this},s.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),c(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}}),e.define("util",function(e,r,t){function n(e){return e instanceof Array||Array.isArray(e)||e&&e!==Object.prototype&&n(e.__proto__)}function o(e){return e instanceof RegExp||"object"==typeof e&&"[object RegExp]"===Object.prototype.toString.call(e)}function i(e){if(e instanceof Date)return!0;if("object"!=typeof e)return!1;var r=Date.prototype&&c(Date.prototype),t=e.__proto__&&c(e.__proto__);return JSON.stringify(t)===JSON.stringify(r)}e("events"),t.print=function(){},t.puts=function(){},t.debug=function(){},t.inspect=function(e,r,a,u){function d(e,a){if(e&&"function"==typeof e.inspect&&e!==t&&(!e.constructor||e.constructor.prototype!==e))return e.inspect(a);switch(typeof e){case"undefined":return p("undefined","undefined");case"string":var u="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p(u,"string");case"number":return p(""+e,"number");case"boolean":return p(""+e,"boolean")}if(null===e)return p("null","null");var f=s(e),h=r?c(e):f;if("function"==typeof e&&0===h.length){if(o(e))return p(""+e,"regexp");var E=e.name?": "+e.name:"";return p("[Function"+E+"]","special")}if(i(e)&&0===h.length)return p(e.toUTCString(),"date");var v,m,y;if(n(e)?(m="Array",y=["[","]"]):(m="Object",y=["{","}"]),"function"==typeof e){var g=e.name?": "+e.name:"";v=o(e)?" "+e:" [Function"+g+"]"}else v="";if(i(e)&&(v=" "+e.toUTCString()),0===h.length)return y[0]+v+y[1];if(0>a)return o(e)?p(""+e,"regexp"):p("[Object]","special");l.push(e);var w=h.map(function(r){var t,o;if(e.__lookupGetter__&&(e.__lookupGetter__(r)?o=e.__lookupSetter__(r)?p("[Getter/Setter]","special"):p("[Getter]","special"):e.__lookupSetter__(r)&&(o=p("[Setter]","special"))),0>f.indexOf(r)&&(t="["+r+"]"),o||(0>l.indexOf(e[r])?(o=null===a?d(e[r]):d(e[r],a-1),o.indexOf("\n")>-1&&(o=n(e)?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=p("[Circular]","special")),t===void 0){if("Array"===m&&r.match(/^\d+$/))return o;t=JSON.stringify(""+r),t.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(t=t.substr(1,t.length-2),t=p(t,"name")):(t=t.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t=p(t,"string"))}return t+": "+o});l.pop();var O=0,_=w.reduce(function(e,r){return O++,r.indexOf("\n")>=0&&O++,e+r.length+1},0);return w=_>50?y[0]+(""===v?"":v+"\n ")+" "+w.join(",\n ")+" "+y[1]:y[0]+v+" "+w.join(", ")+" "+y[1]}var l=[],p=function(e,r){var t={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]},n={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[r];return n?"["+t[n][0]+"m"+e+"["+t[n][1]+"m":e};return u||(p=function(e){return e}),d(e,a===void 0?2:a)},t.log=function(){},t.pump=null;var s=Object.keys||function(e){var r=[];for(var t in e)r.push(t);return r},c=Object.getOwnPropertyNames||function(e){var r=[];for(var t in e)Object.hasOwnProperty.call(e,t)&&r.push(t);return r},a=Object.create||function(e,r){var t;if(null===e)t={__proto__:null};else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var n=function(){};n.prototype=e,t=new n,t.__proto__=e}return r!==void 0&&Object.defineProperties&&Object.defineProperties(t,r),t};t.inherits=function(e,r){e.super_=r,e.prototype=a(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})};var u=/%[sdj%]/g;t.format=function(e){if("string"!=typeof e){for(var r=[],n=0;arguments.length>n;n++)r.push(t.inspect(arguments[n]));return r.join(" ")}for(var n=1,o=arguments,i=o.length,s=(e+"").replace(u,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return o[n++]+"";case"%d":return Number(o[n++]);case"%j":return JSON.stringify(o[n++]);default:return e}}),c=o[n];i>n;c=o[++n])s+=null===c||"object"!=typeof c?" "+c:" "+t.inspect(c);return s}}),e.define("/src/errors.js",function(e,r){var t=e("errno"),n=t.custom.createError("LevelUPError");r.exports={LevelUPError:n,InitializationError:t.custom.createError("InitializationError",n),OpenError:t.custom.createError("OpenError",n),ReadError:t.custom.createError("ReadError",n),WriteError:t.custom.createError("WriteError",n),NotFoundError:t.custom.createError("NotFoundError",n),CloseError:t.custom.createError("CloseError",n)}}),e.define("/node_modules/errno/package.json",function(e,r){r.exports={main:"errno.js"}}),e.define("/node_modules/errno/errno.js",function(e,r){var t=r.exports.all=[{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"no more processes"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:""},{errno:7,code:"EAFNOSUPPORT",description:""},{errno:8,code:"EALREADY",description:""},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:""},{errno:42,code:"EAIFAMNOSUPPORT",description:""},{errno:44,code:"EAISERVICE",description:""},{errno:45,code:"EAISOCKTYPE",description:""},{errno:46,code:"ESHUTDOWN",description:""},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];r.exports.errno={"-1":t[0],0:t[1],1:t[2],2:t[3],3:t[4],4:t[5],5:t[6],6:t[7],7:t[8],8:t[9],9:t[10],10:t[11],11:t[12],12:t[13],13:t[14],14:t[15],15:t[16],16:t[17],17:t[18],18:t[19],19:t[20],20:t[21],21:t[22],22:t[23],23:t[24],24:t[25],25:t[26],26:t[27],27:t[28],28:t[29],29:t[30],31:t[31],32:t[32],33:t[33],34:t[34],35:t[35],36:t[36],37:t[37],38:t[38],39:t[39],40:t[40],41:t[41],42:t[42],44:t[43],45:t[44],46:t[45],47:t[46],48:t[47],49:t[48],50:t[49],51:t[50],52:t[51],53:t[52],54:t[53],55:t[54],56:t[55],57:t[56],58:t[57],59:t[58]},r.exports.code={UNKNOWN:t[0],OK:t[1],EOF:t[2],EADDRINFO:t[3],EACCES:t[4],EAGAIN:t[5],EADDRINUSE:t[6],EADDRNOTAVAIL:t[7],EAFNOSUPPORT:t[8],EALREADY:t[9],EBADF:t[10],EBUSY:t[11],ECONNABORTED:t[12],ECONNREFUSED:t[13],ECONNRESET:t[14],EDESTADDRREQ:t[15],EFAULT:t[16],EHOSTUNREACH:t[17],EINTR:t[18],EINVAL:t[19],EISCONN:t[20],EMFILE:t[21],EMSGSIZE:t[22],ENETDOWN:t[23],ENETUNREACH:t[24],ENFILE:t[25],ENOBUFS:t[26],ENOMEM:t[27],ENOTDIR:t[28],EISDIR:t[29],ENONET:t[30],ENOTCONN:t[31],ENOTSOCK:t[32],ENOTSUP:t[33],ENOENT:t[34],ENOSYS:t[35],EPIPE:t[36],EPROTO:t[37],EPROTONOSUPPORT:t[38],EPROTOTYPE:t[39],ETIMEDOUT:t[40],ECHARSET:t[41],EAIFAMNOSUPPORT:t[42],EAISERVICE:t[43],EAISOCKTYPE:t[44],ESHUTDOWN:t[45],EEXIST:t[46],ESRCH:t[47],ENAMETOOLONG:t[48],EPERM:t[49],ELOOP:t[50],EXDEV:t[51],ENOTEMPTY:t[52],ENOSPC:t[53],EIO:t[54],EROFS:t[55],ENODEV:t[56],ESPIPE:t[57],ECANCELED:t[58]},r.exports.custom=e("./custom")(r.exports)}),e.define("/node_modules/errno/custom.js",function(e,r){function t(e,r,t){this.name=e,this.cause="string"!=typeof r?r:t,this.message=r&&"string"!=typeof r?r.message:r}function n(e,r){Error.call(this),Error.captureStackTrace(this,arguments.callee),t.call(this,"CustomError",e,r)}function o(e,r,o){var i=function(n,o){t.call(this,r,n,o),"FilesystemError"==r&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace(this,arguments.callee)};return i.prototype=o?new o:new n,i}n.prototype=Error(),r.exports=function(e){var r=o.bind(null,e);return{CustomError:n,FilesystemError:r("FilesystemError"),createError:r}}}),e.define("/src/utils.js",function(e,r){function t(e,r){return"json"===r?JSON.stringify(e):e}function n(e,r){return"json"===r?JSON.parse(""+e):e}function o(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e}function i(e,r){function t(){this.constructor=e}return o(e,r),t.prototype=r.prototype,e.prototype=new t,e.__super__=r.prototype,e}function s(e,r){if(r)return r(e);throw e}r.exports={encode:t,decode:n,extend:o,inherits:i,handleError:s}}),e.define("/src/indexedup.js",function(e,r,t,n,o,i){function s(e,r){if(null==r&&(r={}),"string"!=typeof e){var t=new l.InitializationError("Must provide a location for the database");return p.handleError(t)}this._options=p.extend({createIfMissing:!1,errorIfExists:!1,encoding:"utf8",sync:!1},r),this._storename="indexedup",this._location=e,this._status="new"}function c(e,r){this.idb=e,this.readable=!0,i.nextTick(this.init.bind(this)),this._options=p.extend({start:null,end:null,reverse:!1,keys:!0,values:!0,limit:-1},r)}function a(e){this.idb=e,this.writable=!0,this.buffer=[],this._end=!1,this.scheduled=!1,this.flushWrites=this.flushWrites.bind(this)}function u(e,r,t){"function"==typeof r&&(t=r,r=null);var n=new s(e,r);return n.open(t)}var d=e("stream"),l=e("./errors"),p=e("./utils"),f=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB||window.oIndexedDB;window.IDBTransaction||window.mozIDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction||window.oIndexedDB;var h=window.IDBKeyRange||window.mozIDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange||window.oIDBKeyRange;s.prototype.open=function(e){function r(){var e=null;try{e=t.getStore(!0)}catch(r){}if(!o)return t._options.errorIfExists&&null!=e?new l.OpenError("Database already exists (errorIfExists: true)"):t._options.createIfMissing||e?(o=!0,!1):new l.OpenError("Database doesn't exist (createIfMissing: false)")}var t=this,n=f.open(this._location),o=!1;n.onsuccess=function(){t.db=n.result,t._status="open";var o;return(o=r())?p.handleError(o,e):("function"==typeof e&&e(null,t),void 0)},n.onupgradeneeded=function(n){var o;if(o=r())return p.handleError(o,e);var i=n.target.result;t.store=i.createObjectStore(t._storename,{keyPath:"key"})},n.onerror=function(r){var t=new l.OpenError(r);return p.handleError(t,e)}},s.prototype.close=function(e){if(this.isOpen())return this.db=null,this._status="closed",e();var r=new l.CloseError("Cannot close unopened database");return p.handleError(r,e)},s.prototype.isOpen=function(){return"open"===this._status},s.prototype.isClosed=function(){return"closed"===this._status},s.prototype.getTransaction=function(e){var r=e?"readwrite":"readonly";return this.db.transaction([this._storename],r)},s.prototype.getStore=function(e,r){return null==r&&(r=this.getTransaction(e)),r.objectStore(this._storename)},s.prototype.put=function(e,r,t,n){if("function"==typeof t&&(n=t,t=null),!this.isOpen()){var o=new l.WriteError("Database has not been opened");return p.handleError(o,n)}if(null==e){var o=new l.WriteError("Invalid key");return p.handleError(o,n)}if(null==r){var o=new l.WriteError("Invalid data");return p.handleError(o,n)}var i=this.getStore(!0).put({key:e,value:r});i.onsuccess=function(){return"function"==typeof n?n(null,i.result):void 0},i.onerror=function(e){return o=new l.WriteError(e),p.handleError(o,n)}},s.prototype.get=function(e,r,t){if("function"==typeof r&&(t=r,r=t),!this.isOpen()){var n=new l.ReadError("Database has not been opened");return p.handleError(n,t)}if(null==e){var n=new l.ReadError("Invalid key");return p.handleError(n,t)}var o=this.getStore().get(e);o.onsuccess=function(){o.result,o.result!==void 0&&"function"==typeof t?t(null,o.result.value):o.onerror()},o.onerror=function(r){var r=new l.NotFoundError("Key not found in database ["+e+"]");return p.handleError(r,t)}},s.prototype.del=function(e,r,t){if("function"==typeof r&&(t=r,r=t),!this.isOpen()){var n=new l.WriteError("Database has not been opened");return p.handleError(n,t)}if(null==e){var n=new l.WriteError("Invalid key");return p.handleError(n,t)}var o=this.getStore(!0)["delete"](e);o.onsuccess=function(){"function"==typeof t&&t(null,o.result)},o.onerror=function(e){var r=new l.WriteError(e);if("function"==typeof t)return t(r);throw r}},s.prototype.batch=function(e,r){if(!this.isOpen()){var t=new l.WriteError("Database has not been opened");return p.handleError(t,r)}for(var n=this.getTransaction(!0),o=this.getStore(null,n),i=0,s=e.length;s>i;i++){var c=e[i];if(null!=c.type&&null!=c.key)switch(c.type){case"put":o.put({key:c.key,value:c.value});break;case"del":o["delete"](c.key)}}n.oncomplete=function(){"function"==typeof r&&r()},n.onerror=function(e){var t=new l.WriteError(e);return p.handleError(t,r)}},p.inherits(c,d.Stream),c.prototype.init=function(e){var r=this,t=this.idb.getTransaction(),n=this.idb.getStore(t),o=h.lowerBound(0),i=n.openCursor(o),e=this._options;i.onsuccess=function(t){var n=t.target.result,o=null;return n?(e.keys&&e.values?o=n.value:e.keys&&!e.values?o=n.value.key:e.values&&(o=n.value.value),r.emit("data",o),n["continue"](),void 0):(r.end(),void 0)},i.onerror=function(e){r.emit("error",e)}},c.prototype.end=function(){this.emit("end")},p.inherits(a,d.Stream),a.prototype.write=function(e){return this.writable?(0===this.buffer.length&&(i.nextTick(this.flushWrites),this.scheduled=!0),this.buffer.push(e),!0):!1},a.prototype.flushWrites=function(){if(this.scheduled=!1,this.writable){var e=this;if(1===this.buffer.length){var r=this.buffer.shift();this.idb.put(r.key,r.value,function(r){r&&e.emit("error",r)})}else this.buffer.length>1&&(this.buffer.map(function(e){e.type="put"}),this.idb.batch(this.buffer,function(r){r&&e.emit("error",r)}));this._end&&(this.writable=!1,this.emit("close"))}},a.prototype.destroy=function(){this.writable=!1,this.end()},a.prototype.end=function(){this._end=!0,this.scheduled||i.nextTick(this.flushWrites)},s.prototype.readStream=function(){return new c(this)},s.prototype.keyStream=function(){return new c(this,{keys:!0,values:!1})},s.prototype.valueStream=function(){return new c(this,{keys:!1,values:!0})},s.prototype.writeStream=function(){return new a(this)},r!==void 0&&r.exports&&(r.exports=u),"undefined"!=typeof window&&(window.indexedup=u)}),e("/src/indexedup.js")})();
View
382 lib/indexedup.js
@@ -1036,24 +1036,18 @@ exports.format = function(f) {
});
-require.define("/src/errors.coffee",function(require,module,exports,__dirname,__filename,process,global){(function() {
- var LevelUPError, errno;
-
- errno = require('errno');
-
- LevelUPError = errno.custom.createError('LevelUPError');
-
- module.exports = {
- LevelUPError: LevelUPError,
- InitializationError: errno.custom.createError('InitializationError', LevelUPError),
- OpenError: errno.custom.createError('OpenError', LevelUPError),
- ReadError: errno.custom.createError('ReadError', LevelUPError),
- WriteError: errno.custom.createError('WriteError', LevelUPError),
- NotFoundError: errno.custom.createError('NotFoundError', LevelUPError),
- CloseError: errno.custom.createError('CloseError', LevelUPError)
- };
-
-}).call(this);
+require.define("/src/errors.js",function(require,module,exports,__dirname,__filename,process,global){var errno = require('errno')
+ , LevelUPError = errno.custom.createError('LevelUPError')
+
+module.exports = {
+ LevelUPError : LevelUPError
+ , InitializationError : errno.custom.createError('InitializationError', LevelUPError)
+ , OpenError : errno.custom.createError('OpenError', LevelUPError)
+ , ReadError : errno.custom.createError('ReadError', LevelUPError)
+ , WriteError : errno.custom.createError('WriteError', LevelUPError)
+ , NotFoundError : errno.custom.createError('NotFoundError', LevelUPError)
+ , CloseError : errno.custom.createError('CloseError', LevelUPError)
+}
});
@@ -1536,10 +1530,34 @@ module.exports = function (errno) {
}
});
-require.define("/src/indexedup.js",function(require,module,exports,__dirname,__filename,process,global){__extends = function(child, parent) {
- for (var key in parent) {
- if (Object.prototype.hasOwnProperty.call(parent, key)) child[key] = parent[key]
+require.define("/src/utils.js",function(require,module,exports,__dirname,__filename,process,global){
+function encode (data, encoding) {
+ if (encoding === 'json'){
+ return JSON.stringify(data)
+ } else {
+ return data
+ }
+}
+
+function decode (data, encoding) {
+ if (encoding === 'json'){
+ return JSON.parse(data.toString())
+ } else {
+ return data
+ }
+}
+
+function extend (dest, src) {
+ for (var key in src){
+ if (Object.prototype.hasOwnProperty.call(src, key)){
+ dest[key] = src[key]
+ }
}
+ return dest
+}
+
+function inherits (child, parent) {
+ extend(child, parent)
function ctor() {
this.constructor = child
}
@@ -1549,8 +1567,27 @@ require.define("/src/indexedup.js",function(require,module,exports,__dirname,__f
return child
}
-var stream = require('stream')
+function handleError (err, cb) {
+ if (cb) return cb(err)
+ throw err
+}
+
+module.exports = {
+ encode: encode
+ , decode: decode
+ , extend: extend
+ , inherits: inherits
+ , handleError: handleError
+}
+
+});
+
+require.define("/src/indexedup.js",function(require,module,exports,__dirname,__filename,process,global){var stream = require('stream')
, errors = require('./errors')
+ , util = require('./utils')
+
+// IndexedDB fallbacks
+// -------------------
var indexedDB = window.indexedDB
|| window.mozIndexedDB
@@ -1570,54 +1607,10 @@ var IDBKeyRange = window.IDBKeyRange
|| window.msIDBKeyRange
|| window.oIDBKeyRange
-function ReadableStream(idb) {
- this.idb = idb
- this.readable = true
- process.nextTick(this.init.bind(this))
-}
-
-__extends(ReadableStream, stream.Stream)
-
-ReadableStream.prototype.init = function() {
-
- var self = this
- , transaction = this.idb.db.transaction([this.idb.storename], 'readonly')
- , store = transaction.objectStore(this.idb.storename)
- , keyRange = IDBKeyRange.lowerBound(0)
-
- req = store.openCursor(keyRange)
-
- req.onsuccess = function(e) {
- var result = e.target.result
- if (!result) return
- self.emit('data', result.value)
- return result['continue']()
- }
-
- req.onerror = function(err) {
- return self.emit('error', err)
- }
-
- return transaction.oncomplete = function() {
- return self.end()
- }
-}
-
-ReadableStream.prototype.write = function(chunk, encoding) {
- this.emit('data', chunk)
-}
-
-ReadableStream.prototype.end = function() {
- this.emit('end')
-}
-
-function handleError(err, cb) {
- if (cb) {
- return cb(err)
- }
- throw err
-}
-
+// IUDatabase
+// ----------------
+// This is what you get from an indexedup() call.
+// It should mirror node-levelup's API.
function IUDatabase(path, options) {
if (options == null) {
@@ -1625,18 +1618,18 @@ function IUDatabase(path, options) {
}
if (typeof path !== 'string') {
- err = new errors.InitializationError('Must provide a location for the database')
- return handleError(err)
+ var err = new errors.InitializationError('Must provide a location for the database')
+ return util.handleError(err)
}
- this._options = {
- createIfMissing: options.createIfMissing || false
- , errorIfExists: options.errorIfExists || false
- , encoding: options.encoding || 'json'
+ this._options = util.extend({
+ createIfMissing: false
+ , errorIfExists: false
+ , encoding: 'utf8'
, sync: false
- }
+ }, options)
- this.storename = 'indexedup'
+ this._storename = 'indexedup'
this._location = path
this._status = 'new'
}
@@ -1645,48 +1638,53 @@ IUDatabase.prototype.open = function(cb) {
var self = this
, request = indexedDB.open(this._location)
+ , optionsChecked = false
- function checkOptions(store) {
- var store = null
+ function checkOptions() {
+ var store = null
try {
- store = this.getStore(true)
+ store = self.getStore(true)
} catch (e) {}
- if (this._options.errorIfExists === true && (store != null)) {
- err = new errors.OpenError("Database already exists (errorIfExists: true)")
- handleError(err, cb)
- return true
+ if (optionsChecked) {
+ return
}
- if (this._options.createIfMissing === false && !store) {
- err = new errors.OpenError("Database doesn't exist (createIfMissing: false)")
- handleError(err, cb)
- return true
+ if (self._options.errorIfExists && (store != null)) {
+ return new errors.OpenError("Database already exists (errorIfExists: true)")
+ } else if (!self._options.createIfMissing && !store) {
+ return new errors.OpenError("Database doesn't exist (createIfMissing: false)")
}
- checkOptions = function(){}
+ optionsChecked = true
return false
}
request.onsuccess = function(e) {
self.db = request.result
- if (checkOptions.call(_this)) return
+ self._status = 'open'
+ var err
+ if (err = checkOptions()) {
+ return util.handleError(err, cb)
+ }
if (typeof cb === 'function') {
cb(null, self)
}
- self._status = 'open'
}
request.onupgradeneeded = function(e) {
- if (checkOptions.call(_this)) return
+ var err
+ if (err = checkOptions()) {
+ return util.handleError(err, cb)
+ }
var db = e.target.result
- self.store = db.createObjectStore(_this.storename, { keyPath: 'key' })
+ self.store = db.createObjectStore(self._storename, { keyPath: 'key' })
}
request.onerror = function(e) {
var err = new errors.OpenError(e)
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
}
@@ -1696,8 +1694,8 @@ IUDatabase.prototype.close = function(cb) {
this._status = 'closed'
return cb()
} else {
- err = new errors.CloseError('Cannot close unopened database')
- return handleError(err, cb)
+ var err = new errors.CloseError('Cannot close unopened database')
+ return util.handleError(err, cb)
}
}
@@ -1711,14 +1709,14 @@ IUDatabase.prototype.isClosed = function() {
IUDatabase.prototype.getTransaction = function(write) {
var mode = write ? 'readwrite' : 'readonly'
- return this.db.transaction([this.storename], mode)
+ return this.db.transaction([this._storename], mode)
}
IUDatabase.prototype.getStore = function(write, transaction) {
if (transaction == null) {
transaction = this.getTransaction(write)
}
- return transaction.objectStore(this.storename)
+ return transaction.objectStore(this._storename)
}
IUDatabase.prototype.put = function(key, data, options, cb) {
@@ -1728,18 +1726,18 @@ IUDatabase.prototype.put = function(key, data, options, cb) {
}
if (!this.isOpen()) {
var err = new errors.WriteError('Database has not been opened')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
if (key == null) {
var err = new errors.WriteError('Invalid key')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
if (data == null) {
var err = new errors.WriteError('Invalid data')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
- req = this.getStore(true).put({ key: key, value: data })
+ var req = this.getStore(true).put({ key: key, value: data })
req.onsuccess = function(e) {
return typeof cb === "function" ? cb(null, req.result) : void 0
@@ -1747,7 +1745,7 @@ IUDatabase.prototype.put = function(key, data, options, cb) {
req.onerror = function(e) {
err = new errors.WriteError(e)
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
}
@@ -1758,14 +1756,14 @@ IUDatabase.prototype.get = function(key, options, cb) {
}
if (!this.isOpen()) {
var err = new errors.ReadError('Database has not been opened')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
if (key == null) {
var err = new errors.ReadError('Invalid key')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
- req = this.getStore().get(key)
+ var req = this.getStore().get(key)
req.onsuccess = function(e) {
var result = req.result
@@ -1778,7 +1776,7 @@ IUDatabase.prototype.get = function(key, options, cb) {
req.onerror = function(err) {
var err = new errors.NotFoundError("Key not found in database [" + key + "]")
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
}
@@ -1789,14 +1787,14 @@ IUDatabase.prototype.del = function(key, options, cb) {
}
if (!this.isOpen()) {
var err = new errors.WriteError('Database has not been opened')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
if (key == null) {
var err = new errors.WriteError('Invalid key')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
- req = this.getStore(true)["delete"](key)
+ var req = this.getStore(true)["delete"](key)
req.onsuccess = function(e) {
if (typeof cb === "function") {
@@ -1815,22 +1813,22 @@ IUDatabase.prototype.del = function(key, options, cb) {
IUDatabase.prototype.batch = function(arr, cb) {
if (!this.isOpen()) {
var err = new errors.WriteError('Database has not been opened')
- return handleError(err, cb)
+ return util.handleError(err, cb)
}
var transaction = this.getTransaction(true)
, store = this.getStore(null, transaction)
- for (_i = 0, _len = arr.length; _i < _len; _i++) {
- op = arr[_i]
+ for (var i = 0, ln = arr.length; i < ln; i++) {
+ var op = arr[i]
if (op.type == null || op.key == null) continue
switch(op.type) {
case 'put':
store.put({ key: op.key, value: op.value })
break
- case 'get':
- store.delete(op.key)
+ case 'del':
+ store['delete'](op.key)
break
}
}
@@ -1841,27 +1839,167 @@ IUDatabase.prototype.batch = function(arr, cb) {
transaction.onerror = function(e) {
var err = new errors.WriteError(e)
- return handleError(err, cb)
+ return util.handleError(err, cb)
+ }
+}
+
+// Readable/Writable streams
+// -------------------------
+
+function ReadableStream(idb, options) {
+ this.idb = idb
+ this.readable = true
+ process.nextTick(this.init.bind(this))
+
+ this._options = util.extend({
+ start : null
+ , end : null
+ , reverse : false
+ , keys : true
+ , values : true
+ , limit : -1
+ }, options)
+}
+
+util.inherits(ReadableStream, stream.Stream)
+
+ReadableStream.prototype.init = function(options) {
+ var self = this
+ , transaction = this.idb.getTransaction()
+ , store = this.idb.getStore(transaction)
+ , keyRange = IDBKeyRange.lowerBound(0)
+ , req = store.openCursor(keyRange)
+ , options = this._options
+
+ req.onsuccess = function(e) {
+ var cursor = e.target.result
+ , data = null
+
+ if (!cursor) {
+ self.end()
+ return
+ }
+
+ if (options.keys && options.values) {
+ data = cursor.value
+ } else if (options.keys && !options.values) {
+ data = cursor.value.key
+ } else if (options.values) {
+ data = cursor.value.value
+ }
+
+ self.emit('data', data)
+ cursor['continue']()
+ }
+
+ req.onerror = function(err) {
+ self.emit('error', err)
+ }
+}
+
+ReadableStream.prototype.end = function() {
+ this.emit('end')
+}
+
+function WritableStream(idb, options) {
+ this.idb = idb
+ this.writable = true
+ this.buffer = []
+ this._end = false
+ this.scheduled = false
+ this.flushWrites = this.flushWrites.bind(this)
+}
+
+util.inherits(WritableStream, stream.Stream)
+
+WritableStream.prototype.write = function(data) {
+ if (!this.writable) {
+ return false
+ }
+ if (this.buffer.length === 0) {
+ process.nextTick(this.flushWrites)
+ this.scheduled = true
+ }
+
+ this.buffer.push(data)
+
+ return true
+}
+
+WritableStream.prototype.flushWrites = function() {
+
+ this.scheduled = false
+
+ if (!this.writable) {
+ return
+ }
+
+ var self = this
+
+ if (this.buffer.length === 1) {
+ var data = this.buffer.shift()
+ this.idb.put(data.key, data.value, function(err) {
+ if (err) self.emit('error', err)
+ })
+ } else if (this.buffer.length > 1) {
+ var ops = this.buffer.map(function(o){
+ o.type = 'put'
+ })
+ this.idb.batch(this.buffer, function(err) {
+ if (err) self.emit('error', err)
+ })
+ }
+
+ if (this._end) {
+ this.writable = false
+ this.emit('close')
+ }
+}
+
+WritableStream.prototype.destroy = function() {
+ this.writable = false
+ this.end()
+}
+
+WritableStream.prototype.end = function(){
+ this._end = true
+ if (!this.scheduled) {
+ process.nextTick(this.flushWrites)
}
}
IUDatabase.prototype.readStream = function() {
- return new ReadableStream(this)
+ return new ReadableStream(this)
}
+IUDatabase.prototype.keyStream = function() {
+ return new ReadableStream(this, { keys: true, values: false })
+}
+
+IUDatabase.prototype.valueStream = function() {
+ return new ReadableStream(this, { keys: false, values: true })
+}
+
+IUDatabase.prototype.writeStream = function() {
+ return new WritableStream(this)
+}
+
+// Entry point.
+// Creates, opens and returns a IUDatabase instance.
function IndexedUp(path, options, cb) {
if (typeof options === 'function') {
cb = options
options = null
}
- newdb = new IUDatabase(path, options)
+ var newdb = new IUDatabase(path, options)
return newdb.open(cb)
}
-if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
+if (typeof module !== "undefined" && module.exports) {
module.exports = IndexedUp
-} else {
- window.indexedup = IndexedUp
+}
+if (typeof window !== 'undefined') {
+ window['indexedup'] = IndexedUp
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.