Skip to content

Commit

Permalink
[TIMOB-20557] Avoid defining function within a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
janvennemann committed Aug 25, 2017
1 parent 3b596f2 commit 20f22a0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions iphone/cli/hooks/frameworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

'use strict';

const appc = require('node-appc');
const exec = require('child_process').exec;
const fs = require('fs');
const IncrementalFileTask = require('appc-tasks').IncrementalFileTask;
Expand Down Expand Up @@ -124,15 +123,17 @@ class FrameworkManager {
}

for (let pathToScan of pathsToScan) {
let scanPromise = this.scanPathForFrameworks(pathToScan).then(result => {
if (result) {
foundFrameworkPaths = foundFrameworkPaths.concat(result);
}
});
let scanPromise = this.scanPathForFrameworks(pathToScan);
scanPromises.push(scanPromise);
}

return Promise.all(scanPromises).then(() => foundFrameworkPaths);
return Promise.all(scanPromises).then((results) => {
for (let result of results) {
if (result) {
foundFrameworkPaths = foundFrameworkPaths.concat(result);
}
}
}).then(() => foundFrameworkPaths);
}

/**
Expand Down

0 comments on commit 20f22a0

Please sign in to comment.