From a773d025d4eac7d2b704df5e515fa73bd5ea3787 Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Wed, 18 Mar 2015 17:32:14 +0100 Subject: [PATCH] Code review --- .../ng-admin/Crud/misc/PromisesResolver.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/javascripts/ng-admin/Crud/misc/PromisesResolver.js b/src/javascripts/ng-admin/Crud/misc/PromisesResolver.js index 746bf568..7aa426d7 100644 --- a/src/javascripts/ng-admin/Crud/misc/PromisesResolver.js +++ b/src/javascripts/ng-admin/Crud/misc/PromisesResolver.js @@ -25,15 +25,12 @@ define(function () { function resolve(result) { states[key] = true; results[key] = result; // result may be an error - var allFinished = true; - states.forEach(function (state) { - if (!state) { - allFinished = false; + for (var i in states) { + if (!states[i]) { + return; } - }); - if (allFinished) { - deferred.resolve(results); } + deferred.resolve(results); } function resolveSuccess(result) { return resolve({ status: 'success', result: result });