Lodash BaseFind Internal Module

3.0.0 · abandoned · verified Tue Apr 21

lodash._basefind is an npm package exporting the internal `baseFind` utility function from the Lodash v3 codebase. This package was part of an older modularization strategy for Lodash, allowing developers to import specific internal functions as standalone Node.js/io.js modules. The `baseFind` function is a core internal utility responsible for iterating over collections to find the first element that satisfies a given predicate, forming the basis for higher-level functions like `_.find`. While the main Lodash library has advanced significantly to version 4.x (currently 4.18.x), this specific package remains at version 3.0.0. Its original purpose has largely been superseded by modern tree-shaking capabilities in bundlers and direct imports from `lodash-es` for ESM environments, rendering this package effectively abandoned and no longer actively maintained.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the internal `baseFind` function to locate elements in a collection based on a predicate or property match, analogous to `_.find` in the main Lodash library.

const baseFind = require('lodash._basefind');

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

// Find the first user who is active
const activeUser = baseFind(users, function(o) { return o.active; });
console.log('Found active user:', activeUser); // Expected: { 'user': 'barney', 'age': 36, 'active': true }

// Find the first user older than 38
const olderUser = baseFind(users, { 'age': 40 });
console.log('Found user aged 40:', olderUser); // Expected: { 'user': 'fred', 'age': 40, 'active': false }

// If no match is found
const nonExistent = baseFind(users, { 'age': 99 });
console.log('Found non-existent user:', nonExistent); // Expected: undefined

view raw JSON →