Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

idb-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb-wrapper - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

component.json

218

idbstore.js

@@ -44,3 +44,3 @@ /*jshint expr:true */

* @name IDBStore
* @version 1.0.0
* @version 1.1.0
*

@@ -130,3 +130,3 @@ * @param {Object} [kwArgs] An options object used to configure the store and

*/
version: '1.0.0',
version: '1.1.0',

@@ -384,2 +384,6 @@ /**

onSuccess || (onSuccess = noop);
var hasSuccess = false,
result = null;
if (typeof dataObj[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {

@@ -389,5 +393,13 @@ dataObj[this.keyPath] = this._getUID();

var putTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
putTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
putTransaction.onabort = onError;
putTransaction.onerror = onError;
var putRequest = putTransaction.objectStore(this.storeName).put(dataObj);
putRequest.onsuccess = function (event) {
onSuccess(event.target.result);
hasSuccess = true;
result = event.target.result;
};

@@ -412,6 +424,18 @@ putRequest.onerror = onError;

onSuccess || (onSuccess = noop);
var hasSuccess = false,
result = null;
var getTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
getTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
getTransaction.onabort = onError;
getTransaction.onerror = onError;
var getRequest = getTransaction.objectStore(this.storeName).get(key);
getRequest.onsuccess = function (event) {
onSuccess(event.target.result);
hasSuccess = true;
result = event.target.result;
};

@@ -435,6 +459,18 @@ getRequest.onerror = onError;

onSuccess || (onSuccess = noop);
var hasSuccess = false,
result = null;
var removeTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
removeTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
removeTransaction.onabort = onError;
removeTransaction.onerror = onError;
var deleteRequest = removeTransaction.objectStore(this.storeName)['delete'](key);
deleteRequest.onsuccess = function (event) {
onSuccess(event.target.result);
hasSuccess = true;
result = event.target.result;
};

@@ -464,5 +500,21 @@ deleteRequest.onerror = onError;

var batchTransaction = this.db.transaction([this.storeName] , this.consts.READ_WRITE);
batchTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(hasSuccess);
};
batchTransaction.onabort = onError;
batchTransaction.onerror = onError;
var count = dataArray.length;
var called = false;
var hasSuccess = false;
var onItemSuccess = function () {
count--;
if (count === 0 && !called) {
called = true;
hasSuccess = true;
}
};
dataArray.forEach(function (operation) {

@@ -473,18 +525,14 @@ var type = operation.type;

var onItemError = function (err) {
batchTransaction.abort();
if (!called) {
called = true;
onError(err, type, key);
}
};
if (type == "remove") {
var deleteRequest = batchTransaction.objectStore(this.storeName)['delete'](key);
deleteRequest.onsuccess = function (event) {
count--;
if (count === 0 && !called) {
called = true;
onSuccess();
}
};
deleteRequest.onerror = function (err) {
batchTransaction.abort();
if (!called) {
called = true;
onError(err, type, key);
}
};
deleteRequest.onsuccess = onItemSuccess;
deleteRequest.onerror = onItemError;
} else if (type == "put") {

@@ -495,16 +543,4 @@ if (typeof value[this.keyPath] == 'undefined' && !this.features.hasAutoIncrement) {

var putRequest = batchTransaction.objectStore(this.storeName).put(value);
putRequest.onsuccess = function (event) {
count--;
if (count === 0 && !called) {
called = true;
onSuccess();
}
};
putRequest.onerror = function (err) {
batchTransaction.abort();
if (!called) {
called = true;
onError(err, type, value);
}
};
putRequest.onsuccess = onItemSuccess;
putRequest.onerror = onItemError;
}

@@ -530,9 +566,5 @@ }, this);

if (store.getAll) {
var getAllRequest = store.getAll();
getAllRequest.onsuccess = function (event) {
onSuccess(event.target.result);
};
getAllRequest.onerror = onError;
this._getAllNative(getAllTransaction, store, onSuccess, onError);
} else {
this._getAllCursor(getAllTransaction, onSuccess, onError);
this._getAllCursor(getAllTransaction, store, onSuccess, onError);
}

@@ -542,6 +574,38 @@ },

/**
* Implements getAll for IDB implementations that have a non-standard
* getAll() method.
*
* @param {Object} getAllTransaction An open READ transaction.
* @param {Object} store A reference to the store.
* @param {Function} onSuccess A callback that will be called if the
* operation was successful.
* @param {Function} onError A callback that will be called if an
* error occurred during the operation.
* @private
*/
_getAllNative: function (getAllTransaction, store, onSuccess, onError) {
var hasSuccess = false,
result = null;
getAllTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
getAllTransaction.onabort = onError;
getAllTransaction.onerror = onError;
var getAllRequest = store.getAll();
getAllRequest.onsuccess = function (event) {
hasSuccess = true;
result = event.target.result;
};
getAllRequest.onerror = onError;
},
/**
* Implements getAll for IDB implementations that do not have a getAll()
* method.
*
* @param {Object} tr An open READ transaction.
* @param {Object} getAllTransaction An open READ transaction.
* @param {Object} store A reference to the store.
* @param {Function} onSuccess A callback that will be called if the

@@ -553,7 +617,15 @@ * operation was successful.

*/
_getAllCursor: function (tr, onSuccess, onError) {
var all = [];
var store = tr.objectStore(this.storeName);
_getAllCursor: function (getAllTransaction, store, onSuccess, onError) {
var all = [],
hasSuccess = false,
result = null;
getAllTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
getAllTransaction.onabort = onError;
getAllTransaction.onerror = onError;
var cursorRequest = store.openCursor();
cursorRequest.onsuccess = function (event) {

@@ -566,3 +638,4 @@ var cursor = event.target.result;

else {
onSuccess(all);
hasSuccess = true;
result = all;
}

@@ -586,6 +659,18 @@ };

onSuccess || (onSuccess = noop);
var hasSuccess = false,
result = null;
var clearTransaction = this.db.transaction([this.storeName], this.consts.READ_WRITE);
clearTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
clearTransaction.onabort = onError;
clearTransaction.onerror = onError;
var clearRequest = clearTransaction.objectStore(this.storeName).clear();
clearRequest.onsuccess = function (event) {
onSuccess(event.target.result);
hasSuccess = true;
result = event.target.result;
};

@@ -633,3 +718,3 @@ clearRequest.onerror = onError;

* Normalizes an object containing index data and assures that all
* proprties are set.
* properties are set.
*

@@ -707,2 +792,3 @@ * @param {Object} indexData The index data object to normalize

var hasSuccess = false;
var cursorTransaction = this.db.transaction([this.storeName], this.consts[options.writeAccess ? 'READ_WRITE' : 'READ_ONLY']);

@@ -714,2 +800,16 @@ var cursorTarget = cursorTransaction.objectStore(this.storeName);

cursorTransaction.oncomplete = function () {
if (!hasSuccess) {
options.onError(null);
return;
}
if (options.onEnd) {
options.onEnd();
} else {
onItem(null);
}
};
cursorTransaction.onabort = options.onError;
cursorTransaction.onerror = options.onError;
var cursorRequest = cursorTarget.openCursor(options.keyRange, this.consts[directionType]);

@@ -723,7 +823,3 @@ cursorRequest.onerror = options.onError;

} else {
if(options.onEnd){
options.onEnd();
} else {
onItem(null);
}
hasSuccess = true;
}

@@ -784,3 +880,13 @@ };

var hasSuccess = false,
result = null;
var cursorTransaction = this.db.transaction([this.storeName], this.consts.READ_ONLY);
cursorTransaction.oncomplete = function () {
var callback = hasSuccess ? onSuccess : onError;
callback(result);
};
cursorTransaction.onabort = onError;
cursorTransaction.onerror = onError;
var cursorTarget = cursorTransaction.objectStore(this.storeName);

@@ -790,10 +896,8 @@ if (options.index) {

}
var countRequest = cursorTarget.count(options.keyRange);
countRequest.onsuccess = function (evt) {
onSuccess(evt.target.result);
hasSuccess = true;
result = evt.target.result;
};
countRequest.onError = function (error) {
onError(error);
};
countRequest.onError = onError;
},

@@ -800,0 +904,0 @@

@@ -8,4 +8,4 @@ /*

*/
(function(g,e,f){"function"===typeof define?define(e):"undefined"!==typeof module&&module.exports?module.exports=e():f[g]=e()})("IDBStore",function(){var g={storeName:"Store",storePrefix:"IDBWrapper-",dbVersion:1,keyPath:"id",autoIncrement:!0,onStoreReady:function(){},onError:function(a){throw a;},indexes:[]},e=function(a,c){for(var b in g)this[b]="undefined"!=typeof a[b]?a[b]:g[b];this.dbName=this.storePrefix+this.storeName;this.dbVersion=parseInt(this.dbVersion,10);c&&(this.onStoreReady=c);this.idb=
window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB;this.keyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.mozIDBKeyRange;this.consts={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchange",NEXT:"next",NEXT_NO_DUPLICATE:"nextunique",PREV:"prev",PREV_NO_DUPLICATE:"prevunique"};this.openDB()};e.prototype={version:"1.0.0",db:null,dbName:null,dbVersion:null,store:null,storeName:null,keyPath:null,autoIncrement:null,indexes:null,features:null,onStoreReady:null,
(function(j,h,i){"function"===typeof define?define(h):"undefined"!==typeof module&&module.exports?module.exports=h():i[j]=h()})("IDBStore",function(){var j={storeName:"Store",storePrefix:"IDBWrapper-",dbVersion:1,keyPath:"id",autoIncrement:!0,onStoreReady:function(){},onError:function(a){throw a;},indexes:[]},h=function(a,c){for(var b in j)this[b]="undefined"!=typeof a[b]?a[b]:j[b];this.dbName=this.storePrefix+this.storeName;this.dbVersion=parseInt(this.dbVersion,10);c&&(this.onStoreReady=c);this.idb=
window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB;this.keyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.mozIDBKeyRange;this.consts={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchange",NEXT:"next",NEXT_NO_DUPLICATE:"nextunique",PREV:"prev",PREV_NO_DUPLICATE:"prevunique"};this.openDB()};h.prototype={version:"1.1.0",db:null,dbName:null,dbVersion:null,store:null,storeName:null,keyPath:null,autoIncrement:null,indexes:null,features:null,onStoreReady:null,
onError:null,_insertIdCount:0,openDB:function(){(this.features={}).hasAutoIncrement=!window.mozIndexedDB;var a=this.idb.open(this.dbName,this.dbVersion),c=!1;a.onerror=function(a){var c=!1;"error"in a.target?c="VersionError"==a.target.error.name:"errorCode"in a.target&&(c=12==a.target.errorCode);if(c)this.onError(Error("The version number provided is lower than the existing one."));else this.onError(a)}.bind(this);a.onsuccess=function(a){if(!c)if(this.db)this.onStoreReady();else if(this.db=a.target.result,

@@ -15,10 +15,12 @@ "string"==typeof this.db.version)this.onError(Error("The IndexedDB implementation in this browser is outdated. Please upgrade your browser."));else if(this.db.objectStoreNames.contains(this.storeName))this.store=this.db.transaction([this.storeName],this.consts.READ_ONLY).objectStore(this.storeName),this.indexes.forEach(function(a){var b=a.name;b?(this.normalizeIndexData(a),this.hasIndex(b)?this.indexComplies(this.store.index(b),a)||(c=!0,this.onError(Error('Cannot modify index "'+b+'" for current version. Please bump version number to '+

a.target.transaction.objectStore(this.storeName):this.db.createObjectStore(this.storeName,{keyPath:this.keyPath,autoIncrement:this.autoIncrement});this.indexes.forEach(function(a){var b=a.name;b||(c=!0,this.onError(Error("Cannot create index: No index name given.")));this.normalizeIndexData(a);this.hasIndex(b)?this.indexComplies(this.store.index(b),a)||(this.store.deleteIndex(b),this.store.createIndex(b,a.keyPath,{unique:a.unique,multiEntry:a.multiEntry})):this.store.createIndex(b,a.keyPath,{unique:a.unique,
multiEntry:a.multiEntry})},this)}.bind(this)},deleteDatabase:function(){this.idb.deleteDatabase&&this.idb.deleteDatabase(this.dbName)},put:function(a,c,b){b||(b=function(a){console.error("Could not write data.",a)});c||(c=f);"undefined"==typeof a[this.keyPath]&&!this.features.hasAutoIncrement&&(a[this.keyPath]=this._getUID());a=this.db.transaction([this.storeName],this.consts.READ_WRITE).objectStore(this.storeName).put(a);a.onsuccess=function(a){c(a.target.result)};a.onerror=b},get:function(a,c,b){b||
(b=function(a){console.error("Could not read data.",a)});c||(c=f);a=this.db.transaction([this.storeName],this.consts.READ_ONLY).objectStore(this.storeName).get(a);a.onsuccess=function(a){c(a.target.result)};a.onerror=b},remove:function(a,c,b){b||(b=function(a){console.error("Could not remove data.",a)});c||(c=f);a=this.db.transaction([this.storeName],this.consts.READ_WRITE).objectStore(this.storeName)["delete"](a);a.onsuccess=function(a){c(a.target.result)};a.onerror=b},batch:function(a,c,b){b||(b=
function(a){console.error("Could not apply batch.",a)});c||(c=f);"[object Array]"!=Object.prototype.toString.call(a)&&b(Error("dataArray argument must be of type Array."));var d=this.db.transaction([this.storeName],this.consts.READ_WRITE),h=a.length,i=!1;a.forEach(function(a){var e=a.type,f=a.key,g=a.value;if("remove"==e)a=d.objectStore(this.storeName)["delete"](f),a.onsuccess=function(){h--;0===h&&!i&&(i=!0,c())},a.onerror=function(a){d.abort();i||(i=!0,b(a,e,f))};else if("put"==e)"undefined"==typeof g[this.keyPath]&&
!this.features.hasAutoIncrement&&(g[this.keyPath]=this._getUID()),a=d.objectStore(this.storeName).put(g),a.onsuccess=function(){h--;0===h&&!i&&(i=!0,c())},a.onerror=function(a){d.abort();i||(i=!0,b(a,e,g))}},this)},getAll:function(a,c){c||(c=function(a){console.error("Could not read data.",a)});a||(a=f);var b=this.db.transaction([this.storeName],this.consts.READ_ONLY),d=b.objectStore(this.storeName);d.getAll?(b=d.getAll(),b.onsuccess=function(c){a(c.target.result)},b.onerror=c):this._getAllCursor(b,
a,c)},_getAllCursor:function(a,c,b){var d=[],a=a.objectStore(this.storeName).openCursor();a.onsuccess=function(a){(a=a.target.result)?(d.push(a.value),a["continue"]()):c(d)};a.onError=b},clear:function(a,c){c||(c=function(a){console.error("Could not clear store.",a)});a||(a=f);var b=this.db.transaction([this.storeName],this.consts.READ_WRITE).objectStore(this.storeName).clear();b.onsuccess=function(c){a(c.target.result)};b.onerror=c},_getUID:function(){return this._insertIdCount++ +Date.now()},getIndexList:function(){return this.store.indexNames},
hasIndex:function(a){return this.store.indexNames.contains(a)},normalizeIndexData:function(a){a.keyPath=a.keyPath||a.name;a.unique=!!a.unique;a.multiEntry=!!a.multiEntry},indexComplies:function(a,c){return["keyPath","unique","multiEntry"].every(function(b){return"multiEntry"==b&&void 0===a[b]&&!1===c[b]?!0:c[b]==a[b]})},iterate:function(a,c){var c=j({index:null,order:"ASC",filterDuplicates:!1,keyRange:null,writeAccess:!1,onEnd:null,onError:function(a){console.error("Could not open cursor.",a)}},c||
{}),b="desc"==c.order.toLowerCase()?"PREV":"NEXT";c.filterDuplicates&&(b+="_NO_DUPLICATE");var d=this.db.transaction([this.storeName],this.consts[c.writeAccess?"READ_WRITE":"READ_ONLY"]),h=d.objectStore(this.storeName);c.index&&(h=h.index(c.index));b=h.openCursor(c.keyRange,this.consts[b]);b.onerror=c.onError;b.onsuccess=function(b){if(b=b.target.result)a(b.value,b,d),b["continue"]();else if(c.onEnd)c.onEnd();else a(null)}},query:function(a,c){var b=[],c=c||{};c.onEnd=function(){a(b)};this.iterate(function(a){b.push(a)},
c)},count:function(a,c){var c=j({index:null,keyRange:null},c||{}),b=c.onError||function(a){console.error("Could not open cursor.",a)},d=this.db.transaction([this.storeName],this.consts.READ_ONLY).objectStore(this.storeName);c.index&&(d=d.index(c.index));d=d.count(c.keyRange);d.onsuccess=function(b){a(b.target.result)};d.onError=function(a){b(a)}},makeKeyRange:function(a){var c="undefined"!=typeof a.lower,b="undefined"!=typeof a.upper;switch(!0){case c&&b:a=this.keyRange.bound(a.lower,a.upper,a.excludeLower,
a.excludeUpper);break;case c:a=this.keyRange.lowerBound(a.lower,a.excludeLower);break;case b:a=this.keyRange.upperBound(a.upper,a.excludeUpper);break;default:throw Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');}return a}};var f=function(){},k={},j=function(a,c){var b,d;for(b in c)d=c[b],d!==k[b]&&d!==a[b]&&(a[b]=d);return a};e.version=e.prototype.version;return e},this);
multiEntry:a.multiEntry})},this)}.bind(this)},deleteDatabase:function(){this.idb.deleteDatabase&&this.idb.deleteDatabase(this.dbName)},put:function(a,c,b){b||(b=function(a){console.error("Could not write data.",a)});c||(c=i);var d=!1,f=null;"undefined"==typeof a[this.keyPath]&&!this.features.hasAutoIncrement&&(a[this.keyPath]=this._getUID());var e=this.db.transaction([this.storeName],this.consts.READ_WRITE);e.oncomplete=function(){(d?c:b)(f)};e.onabort=b;e.onerror=b;a=e.objectStore(this.storeName).put(a);
a.onsuccess=function(a){d=!0;f=a.target.result};a.onerror=b},get:function(a,c,b){b||(b=function(a){console.error("Could not read data.",a)});c||(c=i);var d=!1,f=null,e=this.db.transaction([this.storeName],this.consts.READ_ONLY);e.oncomplete=function(){(d?c:b)(f)};e.onabort=b;e.onerror=b;a=e.objectStore(this.storeName).get(a);a.onsuccess=function(a){d=!0;f=a.target.result};a.onerror=b},remove:function(a,c,b){b||(b=function(a){console.error("Could not remove data.",a)});c||(c=i);var d=!1,f=null,e=this.db.transaction([this.storeName],
this.consts.READ_WRITE);e.oncomplete=function(){(d?c:b)(f)};e.onabort=b;e.onerror=b;a=e.objectStore(this.storeName)["delete"](a);a.onsuccess=function(a){d=!0;f=a.target.result};a.onerror=b},batch:function(a,c,b){b||(b=function(a){console.error("Could not apply batch.",a)});c||(c=i);"[object Array]"!=Object.prototype.toString.call(a)&&b(Error("dataArray argument must be of type Array."));var d=this.db.transaction([this.storeName],this.consts.READ_WRITE);d.oncomplete=function(){(g?c:b)(g)};d.onabort=
b;d.onerror=b;var f=a.length,e=!1,g=!1,h=function(){f--;0===f&&!e&&(g=e=!0)};a.forEach(function(a){var c=a.type,f=a.key,g=a.value,a=function(a){d.abort();e||(e=!0,b(a,c,f))};if("remove"==c)g=d.objectStore(this.storeName)["delete"](f),g.onsuccess=h,g.onerror=a;else if("put"==c)"undefined"==typeof g[this.keyPath]&&!this.features.hasAutoIncrement&&(g[this.keyPath]=this._getUID()),g=d.objectStore(this.storeName).put(g),g.onsuccess=h,g.onerror=a},this)},getAll:function(a,c){c||(c=function(a){console.error("Could not read data.",
a)});a||(a=i);var b=this.db.transaction([this.storeName],this.consts.READ_ONLY),d=b.objectStore(this.storeName);d.getAll?this._getAllNative(b,d,a,c):this._getAllCursor(b,d,a,c)},_getAllNative:function(a,c,b,d){var f=!1,e=null;a.oncomplete=function(){(f?b:d)(e)};a.onabort=d;a.onerror=d;a=c.getAll();a.onsuccess=function(a){f=!0;e=a.target.result};a.onerror=d},_getAllCursor:function(a,c,b,d){var f=[],e=!1,g=null;a.oncomplete=function(){(e?b:d)(g)};a.onabort=d;a.onerror=d;a=c.openCursor();a.onsuccess=
function(a){(a=a.target.result)?(f.push(a.value),a["continue"]()):(e=!0,g=f)};a.onError=d},clear:function(a,c){c||(c=function(a){console.error("Could not clear store.",a)});a||(a=i);var b=!1,d=null,f=this.db.transaction([this.storeName],this.consts.READ_WRITE);f.oncomplete=function(){(b?a:c)(d)};f.onabort=c;f.onerror=c;f=f.objectStore(this.storeName).clear();f.onsuccess=function(a){b=!0;d=a.target.result};f.onerror=c},_getUID:function(){return this._insertIdCount++ +Date.now()},getIndexList:function(){return this.store.indexNames},
hasIndex:function(a){return this.store.indexNames.contains(a)},normalizeIndexData:function(a){a.keyPath=a.keyPath||a.name;a.unique=!!a.unique;a.multiEntry=!!a.multiEntry},indexComplies:function(a,c){return["keyPath","unique","multiEntry"].every(function(b){return"multiEntry"==b&&void 0===a[b]&&!1===c[b]?!0:c[b]==a[b]})},iterate:function(a,c){var c=k({index:null,order:"ASC",filterDuplicates:!1,keyRange:null,writeAccess:!1,onEnd:null,onError:function(a){console.error("Could not open cursor.",a)}},c||
{}),b="desc"==c.order.toLowerCase()?"PREV":"NEXT";c.filterDuplicates&&(b+="_NO_DUPLICATE");var d=!1,f=this.db.transaction([this.storeName],this.consts[c.writeAccess?"READ_WRITE":"READ_ONLY"]),e=f.objectStore(this.storeName);c.index&&(e=e.index(c.index));f.oncomplete=function(){if(d)if(c.onEnd)c.onEnd();else a(null);else c.onError(null)};f.onabort=c.onError;f.onerror=c.onError;b=e.openCursor(c.keyRange,this.consts[b]);b.onerror=c.onError;b.onsuccess=function(b){(b=b.target.result)?(a(b.value,b,f),
b["continue"]()):d=!0}},query:function(a,c){var b=[],c=c||{};c.onEnd=function(){a(b)};this.iterate(function(a){b.push(a)},c)},count:function(a,c){var c=k({index:null,keyRange:null},c||{}),b=c.onError||function(a){console.error("Could not open cursor.",a)},d=!1,f=null,e=this.db.transaction([this.storeName],this.consts.READ_ONLY);e.oncomplete=function(){(d?a:b)(f)};e.onabort=b;e.onerror=b;e=e.objectStore(this.storeName);c.index&&(e=e.index(c.index));e=e.count(c.keyRange);e.onsuccess=function(a){d=!0;
f=a.target.result};e.onError=b},makeKeyRange:function(a){var c="undefined"!=typeof a.lower,b="undefined"!=typeof a.upper;switch(!0){case c&&b:a=this.keyRange.bound(a.lower,a.upper,a.excludeLower,a.excludeUpper);break;case c:a=this.keyRange.lowerBound(a.lower,a.excludeLower);break;case b:a=this.keyRange.upperBound(a.upper,a.excludeUpper);break;default:throw Error('Cannot create KeyRange. Provide one or both of "lower" or "upper" value.');}return a}};var i=function(){},l={},k=function(a,c){var b,d;
for(b in c)d=c[b],d!==l[b]&&d!==a[b]&&(a[b]=d);return a};h.version=h.prototype.version;return h},this);
{
"name": "idb-wrapper",
"version": "1.0.0",
"version": "1.1.0",
"description": "A cross-browser wrapper for IndexedDB",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -12,5 +12,2 @@ About

"Showing how it works" is the main intention of this project. IndexedDB is
all the buzz, but only a few people actually know how to use it.
The code in idbstore.js is not optimized for anything, nor minified or anything.

@@ -38,3 +35,3 @@ It is meant to be read and easy to understand. So, please, go ahead and check out

There's an API reference over here: http://jensarps.github.com/IDBWrapper/jsdoc/
There's an API reference over here: http://jensarps.github.com/IDBWrapper/jsdoc/IDBStore.html

@@ -53,2 +50,9 @@ You can create a local version of the reference using a terminal. Go into the

IDBWrapper is also available on cdnjs, so you can directly point a script tag
there, or require() it from there. The URL is:
```
//cdnjs.cloudflare.com/ajax/libs/idbwrapper/1.0.0/idbstore.min.js
```
If you use NPM as your package manager, you can get it from there, too, by

@@ -61,2 +65,15 @@ running:

If you use bower as your package manager, run the following:
```bash
$ bower install idbwrapper
```
If you want to add IDBWrapper to a volo project, just run:
```bash
$ volo add idbwrapper
```
Usage

@@ -63,0 +80,0 @@ =====

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc