[Framework] Fix code style in BundleLoader

Fix code style and remove unuseful code from BundleLoader,
WTD-518.
This commit is contained in:
Victor Woeltjen 2014-11-04 13:51:12 -08:00
parent 19bfeb4d03
commit 78effaa09f

View File

@ -1,4 +1,4 @@
/*global define*/ /*global define,Promise*/
/** /**
* Module defining BundleLoader.js. Created by vwoeltje on 10/31/14. * Module defining BundleLoader.js. Created by vwoeltje on 10/31/14.
@ -33,14 +33,7 @@ define(
// loadBundleDefinition, so at this point they are safe // loadBundleDefinition, so at this point they are safe
// to discard. // to discard.
function filterBundles(array) { function filterBundles(array) {
return array.map(function (x) { return x !== undefined; }); return array.filter(function (x) { return x !== undefined; });
}
// Convert JSON bundle definitions to Bundle objects.
function objectifyBundles(bundleDefinitions) {
return bundleDefinitions.map(function (definition) {
return new Bundle()
});
} }
// Load a definition for a bundle // Load a definition for a bundle
@ -67,11 +60,10 @@ define(
} }
function loadBundlesFromArray(bundleArray) { function loadBundlesFromArray(bundleArray) {
var bundlePromises = bundleArray.map(loadBundleDefinition); var bundlePromises = bundleArray.map(loadBundle);
return Promise.all(bundlePromises) return Promise.all(bundlePromises)
.then(filterBundles) .then(filterBundles);
.then(objectifyBundles);
} }
function loadBundlesFromFile(listFile) { function loadBundlesFromFile(listFile) {