Registry / serialization / lodash._basematches

lodash._basematches

JSON →
library3.2.0jsnpmunverified

This package, `lodash._basematches`, exposes an internal utility function from Lodash v3, specifically `baseMatches`. It's part of Lodash's legacy modularization strategy (pre-v4) where core internal functions were published as individual npm packages. The `baseMatches` function itself is used internally by Lodash to create a predicate function for deep object comparison, similar to how `_.matches` works in the public API. This module is stable at version 3.2.0, which corresponds to the Lodash v3 release line. It is not actively maintained as a standalone module and is considered superseded by the main `lodash` package (v4.x and later) or `lodash-es` for modern usage. Its primary differentiation was being a single-purpose, highly optimized internal primitive available separately, though this approach is now largely deprecated in favor of comprehensive bundles and tree-shakable ES modules.

npm install lodash._basematches
INSTALL
IMPORT
SIG · LODASH._BASEMATCHE
L
lodash._basematches
serializationjavascriptv3.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

baseMatches
const baseMatches = require('lodash._basematches');
import { baseMatches } from 'lodash._basematches';
This package is CommonJS-only and does not provide an ES module export. Direct CommonJS `require` is the only supported import method.
baseMatches (using default import syntax mistakenly)
const baseMatches = require('lodash._basematches');
import baseMatches from 'lodash._basematches';
Even if this package were ESM-compatible, it exports a named function, not a default export. Attempting a default import would result in an undefined value.

Demonstrates how to import and use the `baseMatches` function to create a predicate for object property matching.

const baseMatches = require('lodash._basematches'); // baseMatches takes a source object and returns a predicate function. // The predicate function checks if an object has properties matching the source. const source = { a: 1, b: 'test' }; const predicate = baseMatches(source); console.log('Predicate function created:', typeof predicate === 'function'); const object1 = { a: 1, b: 'test', c: 3 }; const object2 = { a: 1, b: 'wrong' }; const object3 = { a: 1 }; console.log('Matching object1:', predicate(object1)); // Expected: true console.log('Matching object2:', predicate(object2)); // Expected: false console.log('Matching object3:', predicate(object3)); // Expected: false const nestedSource = { user: { id: 123, name: 'Alice' } }; const nestedPredicate = baseMatches(nestedSource); const data1 = { id: 1, user: { id: 123, name: 'Alice', email: 'a@example.com' } }; const data2 = { id: 2, user: { id: 456, name: 'Bob' } }; console.log('Matching data1 (nested):', nestedPredicate(data1)); // Expected: true console.log('Matching data2 (nested):', nestedPredicate(data2)); // Expected: false
Debug
Known issues
breakingThis package is effectively abandoned. Its latest version is 3.2.0, corresponding to Lodash v3. Major changes in Lodash v4 mean this module is not compatible with or recommended for use alongside modern Lodash versions (v4.x and above).
fix
Migrate to using the main `lodash` package or `lodash-es` (for ES Modules) and import the equivalent `_.matches` function directly. For example, `import { matches } from 'lodash-es';` or `const _ = require('lodash'); const matches = _.matches;`
affects: >=4.0.0
gotchaThis module is strictly CommonJS. Attempting to import it using ES module syntax (`import ... from '...'`) in a modern JavaScript environment will result in errors.
fix
Always use `const baseMatches = require('lodash._basematches');` for this specific package. For new projects, prefer `lodash` or `lodash-es` which offer better ESM support.
affects: >=3.2.0
deprecatedAs an internal, legacy module, `lodash._basematches` does not receive security updates. While the function itself might be simple, its use in older, unmaintained applications could expose them to broader security issues if other Lodash v3 internals are present.
fix
Upgrade to a modern version of the main `lodash` package (currently v4.18.x) which actively receives security patches and mitigations for issues like prototype pollution. Do not rely on these granular internal v3 packages in new or security-sensitive projects.
affects: >=3.2.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require()` in an ES module context without proper transpilation or configuration, or directly using `import` with a CommonJS-only package.
fix
Ensure your environment supports CommonJS `require()` (e.g., Node.js without `"type": "module"` in package.json) or transpile your code if targeting a browser. For new projects, use `lodash` or `lodash-es` with native ESM imports.
TypeError: (0 , _lodash_basematches.default) is not a function
Incorrectly trying to import a CommonJS module with `import baseMatches from 'lodash._basematches';` syntax, assuming a default export that doesn't exist.
fix
This package only provides a named export accessible via CommonJS `require`. Change your import to `const baseMatches = require('lodash._basematches');`.
Upgrade
Version history
3.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lodash._basematches — npm install lodash._basematches · libregistry