diff --git a/packages/xo-collection/src/collection.js b/packages/xo-collection/src/collection.js index 16a574c7b..dc82f006a 100644 --- a/packages/xo-collection/src/collection.js +++ b/packages/xo-collection/src/collection.js @@ -57,8 +57,12 @@ export default class Collection extends EventEmitter { this._size = 0 } - getKey (item) { - return item && item.id + // Overridable method used to compute the key of an item when + // unspecified. + // + // Default implementation returns the `id` property. + getKey (value) { + return value && value.id } // -----------------------------------------------------------------