function storageFor(key, modelName, options = {}) {
  if (arguments.length === 2 && typeof modelName === 'object') {
    options = modelName;
    modelName = null;
  }

  assert('The options argument must be an object', typeof options === 'object');

  // normalize key
  key = dasherize(key);

  if (!modelName) {
    return computed(function() {
      if (!storages[key]) {
        storages[key] = createStorage(this, key, null, options);
      }

      return storages[key];
    });
  }

  assert('The second argument must be a string', typeof modelName === 'string');

  return computed(modelName, function() {
    const model = this.get(modelName);

    // if the propertyValue is null/undefined we simply return null/undefined
    if (!model || typeof model === 'undefined') {
      return model;
    }

    const modelKey = _modelKey(model);
    const storageKey = `${key}:${modelKey}`;
    // TODO allow callbacks to delete the storage if model gets deleted

    if (!storages[storageKey]) {
      storages[storageKey] = createStorage(this, key, modelKey, options);
    }

    return storages[storageKey];
  });
}
function storageFor(key, modelName, options = {}) {
  if (arguments.length === 2 && typeof modelName === 'object') {
    options = modelName;
    modelName = null;
  }

  assert('The options argument must be an object', typeof options === 'object');

  
  key = dasherize(key);

  if (!modelName) {
    return computed(function() {
      if (!storages[key]) {
        storages[key] = createStorage(this, key, null, options);
      }

      return storages[key];
    });
  }

  assert('The second argument must be a string', typeof modelName === 'string');

  return computed(modelName, function() {
    const model = this.get(modelName);

    
    if (!model || typeof model === 'undefined') {
      return model;
    }

    const modelKey = _modelKey(model);
    const storageKey = `${key}:${modelKey}`;
    

    if (!storages[storageKey]) {
      storages[storageKey] = createStorage(this, key, modelKey, options);
    }

    return storages[storageKey];
  });
}
function storageFor ( key , modelName , options = { } ) { if ( arguments . length === 2 && typeof modelName === 'object' ) { options = modelName ; modelName = null ; } assert ( 'The options argument must be an object' , typeof options === 'object' ) ; // normalize key key = dasherize ( key ) ; if ( ! modelName ) { return computed ( function ( ) { if ( ! storages [ key ] ) { storages [ key ] = createStorage ( this , key , null , options ) ; } return storages [ key ] ; } ) ; } assert ( 'The second argument must be a string' , typeof modelName === 'string' ) ; return computed ( modelName , function ( ) { const model = this . get ( modelName ) ; // if the propertyValue is null/undefined we simply return null/undefined if ( ! model || typeof model === 'undefined' ) { return model ; } const modelKey = _modelKey ( model ) ; const storageKey = ` ${ key } ${ modelKey } ` ; // TODO allow callbacks to delete the storage if model gets deleted if ( ! storages [ storageKey ] ) { storages [ storageKey ] = createStorage ( this , key , modelKey , options ) ; } return storages [ storageKey ] ; } ) ; }
TODO: v2.0 - Remove options
TODO : v2 . 0 - Remove options