Lodash `_.findWhere` Legacy Module

3.1.0 · deprecated · verified Tue Apr 21

The `lodash.findwhere` package provides the `_.findWhere` utility function, originally part of Lodash v3. This standalone module is frozen at version 3.1.0, reflecting the state of the function in the broader Lodash library prior to its major v4 release. `_.findWhere` was deprecated and subsequently removed in Lodash v4 in favor of `_.find` combined with an object shorthand predicate. Consequently, this module is no longer actively maintained or receiving updates, including security patches, that are applied to the modern `lodash` package. Its primary use case now is for maintaining compatibility with legacy codebases tied to Lodash v3, or for selectively importing this specific deprecated functionality into projects that are otherwise on newer Lodash versions but require this exact behavior. Its release cadence is effectively ceased.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `findWhere` function to find an object in a collection based on a properties object, typical for legacy Lodash v3 usage.

const findWhere = require('lodash.findwhere');

const users = [
  { 'user': 'barney', 'age': 36, 'active': true },
  { 'user': 'fred',   'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1, 'active': true }
];

// Find an object where 'age' is 1 and 'active' is true
const result = findWhere(users, { 'age': 1, 'active': true });

console.log(result); // => { 'user': 'pebbles', 'age': 1, 'active': true }

// This demonstrates the original behavior of _.findWhere, which has been superseded.

view raw JSON →