diff --git a/utils/index.js b/utils/index.js index b75e490..94095a3 100644 --- a/utils/index.js +++ b/utils/index.js @@ -55,58 +55,4 @@ export const querablePromise = function(promise) { } return result; - } - - async function get(name, keyPath, transArray) { - - let isValidInput = true - let validInput = [] - - if(isObject(transArray) && has(transArray, ['name', 'keyPath'])){ - isValidInput = true - validInput.push(transArray) - }else if(isArray(transArray)){ - for (const o of transArray) { - isValidInput = has(o, ['name', 'keyPath']) - if(!isValidInput) - break; - } - }else{ - isValidInput = false; - } - - let db = await this.getDb(); - - return new Promise((resolve, reject) => { - - if(!isValidInput) reject("Invalid Input"); - - let trans = db.transaction([...validInput.map(v => v.name)],'readonly'); - trans.oncomplete = () => { - resolve(output); - }; - let output = [] - - for (const o of validInput) { - let store = trans.objectStore(o.name); - // let tr = {}; - - store.openCursor().onsuccess = e => { - let cursor = e.target.result; - if (cursor) { - if(o.keyPath == cursor.value['abbreviation']) - output.push(cursor.value) - // tr = cursor.value - cursor.continue(); - } - }; - } - trans.onerror = e => { - reject(e) - } - trans.onabort = e => { - reject(e) - } - - }); - } \ No newline at end of file + } \ No newline at end of file