function createStorage(context, key, modelKey, options) {
  const owner = getOwner(context);
  const factoryType = 'storage';
  const storageFactory = `${factoryType}:${key}`;

  let storageKey;

  if (options.legacyKey) {
    deprecate('Using legacyKey has been deprecated and will be removed in version 2.0.0', false, {
      id: 'ember-local-storage.storageFor.options.legacyKey',
      until: '2.0.0',
      url: 'https://github.com/funkensturm/ember-local-storage#deprecations'
    });

    storageKey = options.legacyKey;
  } else {
    storageKey = modelKey ? `${storageFactory}:${modelKey}` : storageFactory;
  }

  storageKey = _buildKey(context, storageKey);

  const defaultState = {
    _storageKey: storageKey
  };
  const StorageFactory = owner.factoryFor(storageFactory);

  if (!StorageFactory) {
    throw new TypeError(`Unknown StorageFactory: ${storageFactory}`);
  }

  const StorageFactoryClass = StorageFactory.class;

  if (typeof(StorageFactoryClass.initialState) === 'function') {
    defaultState._initialContent = StorageFactoryClass.initialState.call(
      StorageFactoryClass,
      context
    );
  } else if (StorageFactoryClass.initialState) {
    throw new TypeError('initialState property must be a function');
  }

  if (EmberObject.detect(StorageFactoryClass)) {
    return StorageFactoryClass.create(
      owner.ownerInjection(),
      defaultState
    );
  }

  return EmberObject.create(owner.ownerInjection(), StorageFactoryClass);
}
// TODO: v2.0 - Remove options and legacyKey
v2.0 - Remove options and legacyKey
v2 . 0 - Remove options and legacyKey
function createStorage(context, key, modelKey, options) {
  const owner = getOwner(context);
  const factoryType = 'storage';
  const storageFactory = `${factoryType}:${key}`;
  let storageKey;
  if (options.legacyKey) {
    deprecate('Using legacyKey has been deprecated and will be removed in version 2.0.0', false, {
      id: 'ember-local-storage.storageFor.options.legacyKey',
      until: '2.0.0',
      url: 'https://github.com/funkensturm/ember-local-storage#deprecations'
    });
    storageKey = options.legacyKey;
  } else {
    storageKey = modelKey ? `${storageFactory}:${modelKey}` : storageFactory;
  }
  storageKey = _buildKey(context, storageKey);
  const defaultState = {
    _storageKey: storageKey
  };
  const StorageFactory = owner.factoryFor(storageFactory);
  if (!StorageFactory) {
    throw new TypeError(`Unknown StorageFactory: ${storageFactory}`);
  }
  const StorageFactoryClass = StorageFactory.class;
  if (typeof(StorageFactoryClass.initialState) === 'function') {
    defaultState._initialContent = StorageFactoryClass.initialState.call(
      StorageFactoryClass,
      context
    );
  } else if (StorageFactoryClass.initialState) {
    throw new TypeError('initialState property must be a function');
  }
  if (EmberObject.detect(StorageFactoryClass)) {
    return StorageFactoryClass.create(
      owner.ownerInjection(),
      defaultState
    );
  }
  return EmberObject.create(owner.ownerInjection(), StorageFactoryClass);
}
function createStorage ( context , key , modelKey , options ) { const owner = getOwner ( context ) ; const factoryType = 'storage' ; const storageFactory = ` ${ factoryType } ${ key } ` ; let storageKey ; if ( options . legacyKey ) { deprecate ( 'Using legacyKey has been deprecated and will be removed in version 2.0.0' , false , { id : 'ember-local-storage.storageFor.options.legacyKey' , until : '2.0.0' , url : 'https://github.com/funkensturm/ember-local-storage#deprecations' } ) ; storageKey = options . legacyKey ; } else { storageKey = modelKey ? ` ${ storageFactory } ${ modelKey } ` : storageFactory ; } storageKey = _buildKey ( context , storageKey ) ; const defaultState = { _storageKey : storageKey } ; const StorageFactory = owner . factoryFor ( storageFactory ) ; if ( ! StorageFactory ) { throw new TypeError ( ` ${ storageFactory } ` ) ; } const StorageFactoryClass = StorageFactory . class ; if ( typeof ( StorageFactoryClass . initialState ) === 'function' ) { defaultState . _initialContent = StorageFactoryClass . initialState . call ( StorageFactoryClass , context ) ; } else if ( StorageFactoryClass . initialState ) { throw new TypeError ( 'initialState property must be a function' ) ; } if ( EmberObject . detect ( StorageFactoryClass ) ) { return StorageFactoryClass . create ( owner . ownerInjection ( ) , defaultState ) ; } return EmberObject . create ( owner . ownerInjection ( ) , StorageFactoryClass ) ; }
TODO: v2.0 - Remove options and legacyKey
TODO : v2 . 0 - Remove options and legacyKey