import Ember from 'ember';
import FakeOwner from './fake-owner';

let hasGetOwner = !!Ember.getOwner;

export default function(object) {
  let owner;

  if (hasGetOwner) {
    owner = Ember.getOwner(object);
  }

  if (!owner && object.container) {
    owner = new FakeOwner(object);
  }

  return owner;
};

import Ember from 'ember';
import FakeOwner from './fake-owner';

let getOwner;

if (Ember.getOwner) {
  getOwner = Ember.getOwner;
} else {
  getOwner = function(object) {
    return new FakeOwner(object);
  };
}

export default getOwner;

--- 
+++ 
@@ -1,18 +1,14 @@
 import Ember from 'ember';
 import FakeOwner from './fake-owner';
 
-let hasGetOwner = !!Ember.getOwner;
+let getOwner;
 
-export default function(object) {
-  let owner;
+if (Ember.getOwner) {
+  getOwner = Ember.getOwner;
+} else {
+  getOwner = function(object) {
+    return new FakeOwner(object);
+  };
+}
 
-  if (hasGetOwner) {
-    owner = Ember.getOwner(object);
-  }
-
-  if (!owner && object.container) {
-    owner = new FakeOwner(object);
-  }
-
-  return owner;
-};
+export default getOwner;
Allow to function when `Ember.getOwner` is present but owner is not set.
