mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Fix bugs in ErrorQueueStore and deepMatchObject()
This commit is contained in:
parent
4821e36189
commit
0d6b3710f7
@ -10,7 +10,7 @@ class ErrorQueueStore {
|
||||
constructor() {
|
||||
const { upload: { slowConnection, tryDifferentBrowser } } = ErrorClasses;
|
||||
|
||||
this.errorQueue = {
|
||||
this.errorQueues = {
|
||||
'upload': {
|
||||
queue: [slowConnection, tryDifferentBrowser],
|
||||
loop: true
|
||||
@ -19,11 +19,14 @@ class ErrorQueueStore {
|
||||
|
||||
// Add intial index to each error queue
|
||||
Object
|
||||
.keys(this.errorQueue)
|
||||
.keys(this.errorQueues)
|
||||
.forEach((type) => {
|
||||
this.errorQueue[type].index = 0;
|
||||
this.errorQueues[type].index = 0;
|
||||
});
|
||||
|
||||
// Bind the exported functions to this instance
|
||||
this.getNextError = this.getNextError.bind(this);
|
||||
|
||||
this.exportPublicMethods({
|
||||
getNextError: this.getNextError
|
||||
});
|
||||
|
@ -213,9 +213,12 @@ export function deepMatchObject(obj, match, testFn) {
|
||||
const objProp = obj[matchKey];
|
||||
const matchProp = match[matchKey];
|
||||
|
||||
return (typeof matchProp === 'object') ? testObjAgainstMatch(objProp, matchProp, testFn)
|
||||
: testFn(objProp, matchProp);
|
||||
|
||||
if (typeof matchProp === 'object') {
|
||||
return (typeof objProp === 'object') ? deepMatchObject(objProp, matchProp, testFn)
|
||||
: false;
|
||||
} else {
|
||||
return testFn(objProp, matchProp);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user