Lodash Internal baseValues Function
This package exports the internal `baseValues` function from Lodash v3.0.0 as a standalone Node.js module. It provides a low-level, optimized utility for extracting property values from an object, primarily designed for internal use within the larger Lodash library ecosystem. As a v3 module, it precedes the significant architectural changes introduced in Lodash v4, where modularization strategies shifted towards `lodash-es` and direct path imports from the main `lodash` package for improved tree-shaking and modern JavaScript compatibility. Consequently, `lodash._basevalues` is now largely superseded and is not actively maintained, making it unsuitable for new projects aiming for compatibility with modern Lodash versions or ES module environments. Its release cadence is tied to the legacy Lodash v3 development cycle.
Common errors
-
TypeError: (0 , lodash__basevalues__1.default) is not a function
cause Attempting to use `import baseValues from 'lodash._basevalues'` in an ES module environment when the package is a CommonJS module exporting a single function.fixUse `const baseValues = require('lodash._basevalues');` for CommonJS environments. In ESM, if strict compatibility is required, `import * as baseValuesModule from 'lodash._basevalues'; const baseValues = baseValuesModule.default;` might work, but migration is recommended. -
ReferenceError: baseValues is not defined
cause The `require()` call was not assigned to a variable, or the variable name was misspelled, or the package was not correctly installed/found.fixEnsure `const baseValues = require('lodash._basevalues');` is correctly placed and that `lodash._basevalues` is listed in your `package.json` and installed via `npm install`. -
Error: Cannot find module 'lodash._basevalues'
cause The package `lodash._basevalues` is not installed or the path to the module is incorrect.fixRun `npm install lodash._basevalues` to install the package. Verify the package name in your `require()` statement matches the installed package.
Warnings
- breaking This package belongs to the Lodash v3 modular build system. With the release of Lodash v4, the entire modular strategy changed significantly, making this specific package incompatible or redundant with modern `lodash` or `lodash-es` consumption patterns. Direct usage of internal modules like `_basevalues` is generally discouraged and has been superseded by tree-shakable `lodash-es` or specific paths within the main `lodash` package.
- deprecated This package is based on Lodash v3 and is not actively maintained. It will not receive updates for new features, bug fixes, or security patches relevant to modern Lodash versions. Relying on an unmaintained internal module can lead to compatibility issues and security vulnerabilities.
- gotcha As a CommonJS module, `lodash._basevalues` does not natively support ES module `import` syntax. Attempting to use `import baseValues from 'lodash._basevalues'` will often result in a `TypeError` at runtime, especially in pure ESM environments, or require complex bundler configurations.
- gotcha While Lodash v4.18.0 and v4.18.1 addressed critical security vulnerabilities (e.g., prototype pollution via `_.unset` / `_.omit`) and `ReferenceError` bugs in the main `lodash` and modular builds, this `_basevalues` package is stuck at v3.0.0. Therefore, it does not benefit from these security and bug fixes, potentially leaving applications vulnerable if used in conjunction with other vulnerable Lodash components or contexts.
Install
-
npm install lodash._basevalues -
yarn add lodash._basevalues -
pnpm add lodash._basevalues
Imports
- baseValues
const baseValues = require('lodash._basevalues'); - baseValues (ESM attempt)
import baseValues from 'lodash._basevalues';
- baseValues (ESM namespace import)
import * as baseValuesModule from 'lodash._basevalues'; const baseValues = baseValuesModule.default;
Quickstart
const baseValues = require('lodash._basevalues');
// Example 1: Extracting values from a plain object
const myObject = {
id: 101,
name: 'Widget A',
price: 29.99,
available: true,
tags: ['electronics', 'gadget']
};
const objectValues = baseValues(myObject);
console.log('Values from object:', objectValues);
// Expected output: [101, 'Widget A', 29.99, true, ['electronics', 'gadget']] (order may vary in older JS engines)
// Example 2: Extracting values from an array (treated as an object with numeric keys)
const myArray = ['apple', 'banana', 'cherry'];
const arrayValues = baseValues(myArray);
console.log('Values from array:', arrayValues);
// Expected output: ['apple', 'banana', 'cherry']
// Example 3: Handling non-object inputs (Lodash typically returns an empty array)
console.log('Values from null:', baseValues(null));
console.log('Values from undefined:', baseValues(undefined));