NewDash

    Function findLastKey

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

      Type Parameters

      • V

      Parameters

      • object: Record<string, V>

        The object to inspect.

      • Optionalpredicate: Predicate<V>

        The function invoked per iteration.

      Returns string

      Returns the key of the matched element, else undefined.

      5.2.0

      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'
    • This method is like findKey except that it iterates over elements of a collection in the opposite order.

      Parameters

      • object: any

        The object to inspect.

      • Optionalpredicate: any[]

        The function invoked per iteration.

      Returns string

      Returns the key of the matched element, else undefined.

      5.2.0

      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'
    • This method is like findKey except that it iterates over elements of a collection in the opposite order.

      Parameters

      • object: any

        The object to inspect.

      • Optionalpredicate: string

        The function invoked per iteration.

      Returns string

      Returns the key of the matched element, else undefined.

      5.2.0

      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'
    MMNEPVFCICPMFPCPTTAAATR