react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / array / findIndex.js
80742 viewsvar createFindIndex = require('../internal/createFindIndex');12/**3* This method is like `_.find` except that it returns the index of the first4* element `predicate` returns truthy for instead of the element itself.5*6* If a property name is provided for `predicate` the created `_.property`7* style callback returns the property value of the given element.8*9* If a value is also provided for `thisArg` the created `_.matchesProperty`10* style callback returns `true` for elements that have a matching property11* value, else `false`.12*13* If an object is provided for `predicate` the created `_.matches` style14* callback returns `true` for elements that have the properties of the given15* object, else `false`.16*17* @static18* @memberOf _19* @category Array20* @param {Array} array The array to search.21* @param {Function|Object|string} [predicate=_.identity] The function invoked22* per iteration.23* @param {*} [thisArg] The `this` binding of `predicate`.24* @returns {number} Returns the index of the found element, else `-1`.25* @example26*27* var users = [28* { 'user': 'barney', 'active': false },29* { 'user': 'fred', 'active': false },30* { 'user': 'pebbles', 'active': true }31* ];32*33* _.findIndex(users, function(chr) {34* return chr.user == 'barney';35* });36* // => 037*38* // using the `_.matches` callback shorthand39* _.findIndex(users, { 'user': 'fred', 'active': false });40* // => 141*42* // using the `_.matchesProperty` callback shorthand43* _.findIndex(users, 'active', false);44* // => 045*46* // using the `_.property` callback shorthand47* _.findIndex(users, 'active');48* // => 249*/50var findIndex = createFindIndex();5152module.exports = findIndex;535455