1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +02:00

Fix bugs in ErrorQueueStore and deepMatchObject()

This commit is contained in:
Brett Sun 2015-11-25 18:58:56 +01:00
parent 4821e36189
commit 0d6b3710f7
2 changed files with 12 additions and 6 deletions

View File

@ -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
});

View File

@ -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);
}