Collection #getId() renamed to getKey().

This commit is contained in:
Julien Fontanet 2015-04-18 22:20:57 +02:00
parent 160522c520
commit d4d8ea6cf2
2 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ export default class Collection extends EventEmitter {
this._size = 0
}
getId (item) {
getKey (item) {
return item && item.id
}
@ -259,7 +259,7 @@ export default class Collection extends EventEmitter {
return [keyOrObjectWithId]
}
const key = this.getId(keyOrObjectWithId)
const key = this.getKey(keyOrObjectWithId)
this._assertValidKey(key)
return [key, keyOrObjectWithId]

View File

@ -7,7 +7,7 @@ import View from './view'
// Create the collection.
const users = new Collection()
users.getId = (user) => user.name
users.getKey = (user) => user.name
// Inserts some data.
users.add({