Lodash Internal Object Types
This package, `lodash._objecttypes`, is an internal utility module extracted from Lo-Dash v2.4.1, released in December 2013. It provided the `objectTypes` variable, an internal structure used by Lo-Dash's core functions for type checking (e.g., `isObject`, `isPlainObject`). It was part of Lo-Dash's modularization strategy in its second major version, where internal components and methods were published as separate npm packages. However, this specific package is not intended for direct external consumption and its internal structure, existence, and API stability were never guaranteed. The main Lodash library has since evolved significantly, with the current stable version being 4.18.1 (as of April 2026), and its internal modularization and distribution methods (like `lodash-es` for ES modules) have changed considerably. This package is no longer maintained as a standalone entity and its functionality is integrated or superseded within modern Lodash versions. Its primary historical differentiator was serving as a foundational internal piece of the Lodash v2 type-checking mechanism.
Common errors
-
TypeError: (0, _lodash_objecttypes.default) is not a function
cause Attempting to use ES module `import objectTypes from 'lodash._objecttypes';` or `import { default as objectTypes } from 'lodash._objecttypes';` when the package is CommonJS and does not have a default export.fixUse CommonJS `require` syntax: `const objectTypes = require('lodash._objecttypes');` -
Error: Cannot find module 'lodash._objecttypes'
cause Trying to import this package in a modern Lodash setup, where it is no longer published or included, or if the package manager cannot resolve the ancient version.fixThis package is abandoned and not part of modern Lodash. Do not use it. Instead, use the public API of the main `lodash` package (e.g., `_.isObjectLike`) or `lodash-es` if you need modular ES imports. -
TypeError: require(...) is not a function
cause After `const objectTypes = require('lodash._objecttypes');`, attempting to call `objectTypes()` as a function. The `objectTypes` variable is an object, not a function.fixAccess properties of `objectTypes` directly, e.g., `objectTypes[typeof myVar]`. Do not call it as a function.
Warnings
- breaking This package is an internal utility from Lodash v2.x (released 2013). Its structure, content, and very existence are not stable and are subject to change or removal without notice in any modern Lodash version (v3, v4, or later). Directly depending on it will almost certainly lead to breakage.
- deprecated The entire pattern of exposing granular internal Lodash components as separate npm packages (like `lodash._objecttypes`) has been deprecated. Modern Lodash (v4.x) integrates such utilities internally or provides ES module versions via `lodash-es` for tree-shaking.
- gotcha Lodash v2.4.1, which this package is tied to, is affected by numerous known security vulnerabilities (e.g., Prototype Pollution, Code Injection, Regular Expression Denial of Service) that have been patched in later versions of the main `lodash` library. Using any code derived from such an old version, even an internal utility, introduces significant security risks.
- gotcha This package is strictly CommonJS (`require()`). It does not provide ES module exports (`import`). Attempting to `import` it will result in syntax errors or runtime issues in modern JavaScript environments unless transpiled.
Install
-
npm install lodash._objecttypes -
yarn add lodash._objecttypes -
pnpm add lodash._objecttypes
Imports
- objectTypes
import objectTypes from 'lodash._objecttypes';
const objectTypes = require('lodash._objecttypes'); - objectTypes
const objectTypes = require('lodash._objecttypes')();const objectTypes = require('lodash._objecttypes'); // Then use objectTypes for internal checks, e.g., objectTypes[typeof value] - type checks
const internalTypes = require('lodash._objecttypes'); if (internalTypes[typeof myVar]) { /* ... */ }// Prefer using official Lodash methods like _.isObject, _.isString, etc., from the main 'lodash' package. const _ = require('lodash'); _.isObject({});
Quickstart
const objectTypes = require('lodash._objecttypes');
// In Lodash v2, 'objectTypes' was used internally for quick type checks.
// It typically mapped JavaScript's `typeof` results to booleans.
// For example, to check if a value was an 'object' or 'function'.
console.log('--- lodash._objecttypes example ---');
console.log('Object types map:', objectTypes);
// Example of how it might have been used internally (simplified):
function isObjectLike(value) {
return objectTypes[typeof value] === true;
}
console.log(`isObjectLike(null): ${isObjectLike(null)}`); // null is 'object' via typeof
console.log(`isObjectLike({}): ${isObjectLike({})}`);
console.log(`isObjectLike([]): ${isObjectLike([])}`);
console.log(`isObjectLike(() => {}): ${isObjectLike(() => {})}`);
console.log(`isObjectLike(123): ${isObjectLike(123)}`);
// Note: For actual Lodash usage, always use the main 'lodash' package:
// const _ = require('lodash');
// console.log(`_.isObjectLike({}): ${_.isObjectLike({})}`);