/**
 * ES6 not supported here
 */
import Ember from "ember";
import config from 'ember-get-config';

export default Ember.Mixin.create({

    bundleLoader: Ember.inject.service("bundle-loader"),

    findBundleNameByRoute: function(routeName){
        //Find bundle for route
        var foundBundleName  = Object.keys(config.bundles)
            .find((name)=> {
                let bundle = config.bundles[name];
                return bundle.routes.indexOf(routeName)>-1;
            });
        return foundBundleName;

    },
    beforeModel: function(transition, queryParams){
        this._super(transition,queryParams);
        let service = this.get("bundleLoader");
        let bundleName = this.findBundleNameByRoute(transition.targetName);

        return service.loadBundle(bundleName);
    }

});
@@ -130,17 +130,16 @@
 reate(%7B%0A
-%0A
     bund
@@ -280,22 +280,48 @@
     var 
-foundB
+bundleName = null;%0A        var b
 undleNam
@@ -321,17 +321,17 @@
 ndleName
- 
+s
  = Objec
@@ -352,16 +352,17 @@
 bundles)
+;
 %0A       
@@ -366,26 +366,42 @@
     
-    .find(
+bundleNames.forEach(function
 (name)
-=%3E
  %7B%0A 
@@ -409,25 +409,19 @@
         
-      let
+var
  bundle 
@@ -454,29 +454,19 @@
         
-      return 
+if(
 bundle.r
@@ -493,29 +493,73 @@
 ame)
-%3E-1;%0A     
+ %3E= 0) %7B%0A            bundleName = name;%0A          %7D%0A
        
+ 
 %7D);%0A
+%0A
     
@@ -573,14 +573,9 @@
 urn 
-foundB
+b
 undl
@@ -865,11 +865,12 @@
 %0A    %7D%0A%0A
-
 %7D);
+%0A

Fix tests by switching to es5 syntax in finding bundles