1 var baseFind = require('./_baseFind'),
2 baseForOwnRight = require('./_baseForOwnRight'),
3 baseIteratee = require('./_baseIteratee');
6 * This method is like `_.findKey` except that it iterates over elements of
7 * a collection in the opposite order.
12 * @param {Object} object The object to search.
13 * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
14 * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
18 * 'barney': { 'age': 36, 'active': true },
19 * 'fred': { 'age': 40, 'active': false },
20 * 'pebbles': { 'age': 1, 'active': true }
23 * _.findLastKey(users, function(o) { return o.age < 40; });
24 * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
26 * // The `_.matches` iteratee shorthand.
27 * _.findLastKey(users, { 'age': 36, 'active': true });
30 * // The `_.matchesProperty` iteratee shorthand.
31 * _.findLastKey(users, ['active', false]);
34 * // The `_.property` iteratee shorthand.
35 * _.findLastKey(users, 'active');
38 function findLastKey(object, predicate) {
39 return baseFind(object, baseIteratee(predicate, 3), baseForOwnRight, true);
42 module.exports = findLastKey;