Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

find-last-key

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
30
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 months ago
SIZE
N/A
subject
This method is like `_.findKey` except that it iterates over elements of a collection in the opposite order.
1 contributor
Use find-last-key in your project ?
Copied
npm i @bit/lodash.lodash.find-last-key
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
findLastKey(users, function(o) {
  return o.age < 40;
});
modifieddraft
chevron_left
chevron_right
findLastKey (
object:Object,
predicate:Function?
) : (string | undefined)

This method is like _.findKey except that it iterates over elements of a collection in the opposite order.

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'
Arguments
object: Object

The object to inspect.

predicate: Function?

The function invoked per iteration.

Returns
(string | undefined)

Returns the key of the matched element, else `undefined`.