Sha256: 890b86acc3c01b67fe798f7fdde8f63f51530db598ba264d6347040843d610ad

Contents?: true

Size: 1.31 KB

Versions: 276

Compression:

Stored size: 1.31 KB

Contents

var baseFindKey = require('./_baseFindKey'),
    baseForOwnRight = require('./_baseForOwnRight'),
    baseIteratee = require('./_baseIteratee');

/**
 * This method is like `_.findKey` except that it iterates over elements of
 * a collection in the opposite order.
 *
 * @static
 * @memberOf _
 * @since 2.0.0
 * @category Object
 * @param {Object} object The object to inspect.
 * @param {Function} [predicate=_.identity] The function invoked per iteration.
 * @returns {string|undefined} Returns the key of the matched element,
 *  else `undefined`.
 * @example
 *
 * var users = {
 *   'barney':  { 'age': 36, 'active': true },
 *   'fred':    { 'age': 40, 'active': false },
 *   'pebbles': { 'age': 1,  'active': true }
 * };
 *
 * _.findLastKey(users, function(o) { return o.age < 40; });
 * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
 *
 * // The `_.matches` iteratee shorthand.
 * _.findLastKey(users, { 'age': 36, 'active': true });
 * // => 'barney'
 *
 * // The `_.matchesProperty` iteratee shorthand.
 * _.findLastKey(users, ['active', false]);
 * // => 'fred'
 *
 * // The `_.property` iteratee shorthand.
 * _.findLastKey(users, 'active');
 * // => 'pebbles'
 */
function findLastKey(object, predicate) {
  return baseFindKey(object, baseIteratee(predicate, 3), baseForOwnRight);
}

module.exports = findLastKey;

Version data entries

276 entries across 274 versions & 31 rubygems

Version Path
ela-1.1.0 node_modules/lodash/findLastKey.js
sumomo-0.8.0 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.7.3 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.7.2 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.7.1 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.6.4 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.6.3 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.6.2 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
sumomo-0.6.1 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
affiliator-0.2.1 node_modules/lodash/findLastKey.js
sumomo-0.6.0 data/sumomo/api_modules/node_modules/lodash/findLastKey.js
guard-sass-lint-0.1.2 node_modules/lodash/findLastKey.js
guard-sass-lint-0.1.1 node_modules/lodash/findLastKey.js
lanes-0.8.0 node_modules/lodash/findLastKey.js
lanes-0.8.0 node_modules/globule/node_modules/lodash/findLastKey.js
minimum_viable_product-0.0.11 test/dummy/node_modules/lodash/findLastKey.js