From cba6b08b7a677aa93f51400a40828a5744917e8e Mon Sep 17 00:00:00 2001 From: KtorZ Date: Fri, 30 Jun 2017 22:51:07 +0200 Subject: [PATCH] finalize implementation of cursor.source --- src/Database/IndexedDB/IDBCursor.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Database/IndexedDB/IDBCursor.js b/src/Database/IndexedDB/IDBCursor.js index 8a3641b..c6cd894 100644 --- a/src/Database/IndexedDB/IDBCursor.js +++ b/src/Database/IndexedDB/IDBCursor.js @@ -67,10 +67,14 @@ exports._primaryKey = function _primaryKey(cursor) { }; exports._source = function _source(IDBObjectStore, IDBIndex, cursor) { - console.log(typeof cursor.source); - console.log(Object.getPrototypeOf(cursor.source)); - console.log(cursor.source); - throw new Error('TODO'); + switch (cursor.source.constructor.name) { + case 'IDBIndex': + return IDBIndex(cursor.source); + case 'IDBObjectStore': + return IDBObjectStore(cursor.source); + default: + throw new Error('UnexpectedCursorSource'); + } }; exports._update = function _update(cursor, value) {