lib/list.js
function (key, value) {
    var Item = this.get('Item');

    if (!(value instanceof Item)) {
      value = new Item(value);
    }

    value.key = value.key || key;
    var i = this.indexOf(key);

    if (i !== -1) {
      this.items[i] = value;
    } else {
      this.items.push(value);
      this.keyMap[key] = this.items.length - 1;
    }

    this.emit('item', key, value);
    return this;
  }
function (key, value) {
    var Item = this.get('Item');

    if (!(value instanceof Item)) {
      value = new Item(value);
    }

    value.key = value.key || key;
    var i = this.indexOf(key);

    if (i !== -1) {
      this.items[i] = value;
    } else {
      this.items.push(value);
      this.keyMap[key] = this.items.length - 1;
    }

    this.emit('item', key, value);
    return this;
  }
function ( key , value ) { var Item = this . get ( 'Item' ) ; if ( ! ( value instanceof Item ) ) { value = new Item ( value ) ; } value . key = value . key || key ; var i = this . indexOf ( key ) ; if ( i !== - 1 ) { this . items [ i ] = value ; } else { this . items . push ( value ) ; this . keyMap [ key ] = this . items . length - 1 ; } this . emit ( 'item' , key , value ) ; return this ; }
Add a new item or update an existing item.

```js
list.addItem('foo', {contents: '...'});
```

@param {String} `key`
@param {Object} `value`
@api public
Add a new item or update an existing item .