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;

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;
};

Allow to function when `Ember.getOwner` is present but owner is not set.
Allow to function when `Ember.getOwner` is present but owner is not set.
