Webpack build for branch master: 39013b1242

This commit is contained in:
Travis CI 2017-09-03 10:04:06 +00:00
parent 99e17f7ee3
commit 56123a2887

View file

@ -1061,23 +1061,19 @@ class Collection extends Map {
/** /**
* Searches for the existence of a single item where its specified property's value is identical to the given value * Searches for the existence of a single item where its specified property's value is identical to the given value
* (`item[prop] === value`), or the given function returns a truthy value. * (`item[prop] === value`).
* <warn>Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See * <warn>Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details.</warn> * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details.</warn>
* @param {string|Function} propOrFn The property to test against, or the function to test with * @param {string} prop The property to test against
* @param {*} [value] The expected value - only applicable and required if using a property for the first argument * @param {*} value The expected value
* @returns {boolean} * @returns {boolean}
* @example * @example
* if (collection.exists('username', 'Bob')) { * if (collection.exists('username', 'Bob')) {
* console.log('user here!'); * console.log('user here!');
* } * }
* @example
* if (collection.exists(user => user.username === 'Bob')) {
* console.log('user here!');
* }
*/ */
exists(propOrFn, value) { exists(prop, value) {
return Boolean(this.find(propOrFn, value)); return Boolean(this.find(prop, value));
} }
/** /**