Lodash Internal `baseFindIndex` Module (v3.6.0)

3.6.0 · abandoned · verified Sun Apr 19

This package, `lodash._basefindindex`, provides a standalone CommonJS module for the internal `baseFindIndex` function from Lodash version 3.6.0. This function is an integral part of Lodash's core, designed to find the index of an element within a collection using a predicate, without directly exposing it as a public API method. In its original context, such modular builds allowed for more granular imports and smaller bundle sizes before widespread adoption of ES Modules and advanced tree-shaking capabilities. However, the main Lodash library is now at version 4.18.1, with its v3.x line officially reaching end-of-life in January 2016. Consequently, `lodash._basefindindex` (v3.6.0) is considered an abandoned, legacy package, and its use is generally discouraged in modern JavaScript development in favor of the full `lodash` or `lodash-es` packages, which benefit from active maintenance and regular security updates.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the `baseFindIndex` function from this legacy module. It also contrasts it with the equivalent public API usage in modern Lodash.

const baseFindIndex = require('lodash._basefindindex');

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

// Find the index of the first active user
const predicate = (o) => o.active;
const index = baseFindIndex(users, predicate, 0, false);

console.log(`Index of first active user: ${index}`);

// Example of how you would use the modern public API (not this package)
const _ = require('lodash');
const modernIndex = _.findIndex(users, predicate);
console.log(`Index using modern _.findIndex: ${modernIndex}`);

view raw JSON →