index.js
function(data, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var key = data[this._key.getName()];
      var ix = -1;
      for(var i = 0; i < this._data.length; i++) {
        if(this._data[i][this._key.getName()] === key) {
          ix = i;
          break;
        }
      }
      if(ix === -1) {
        this._data.push(this._clone(data));
      } else {
        this._data[ix] = this._clone(data);
      }
      done(null);
    }
function(data, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var key = data[this._key.getName()];
      var ix = -1;
      for(var i = 0; i < this._data.length; i++) {
        if(this._data[i][this._key.getName()] === key) {
          ix = i;
          break;
        }
      }
      if(ix === -1) {
        this._data.push(this._clone(data));
      } else {
        this._data[ix] = this._clone(data);
      }
      done(null);
    }
function ( data , done ) { if ( ! this . _key ) { done ( 'no key found for metadata' ) ; return ; } var key = data [ this . _key . getName ( ) ] ; var ix = - 1 ; for ( var i = 0 ; i < this . _data . length ; i ++ ) { if ( this . _data [ i ] [ this . _key . getName ( ) ] === key ) { ix = i ; break ; } } if ( ix === - 1 ) { this . _data . push ( this . _clone ( data ) ) ; } else { this . _data [ ix ] = this . _clone ( data ) ; } done ( null ) ; }
update an item in the store
@param  {Object}   data    The item to update
@param  {Function} done The callback when done
update an item in the store