Registry / serialization / lodash._baseassign

lodash._baseassign

JSON →
library3.2.0jsnpmunverified

This package provides the internal `baseAssign` function from Lodash version 3.2.0, exporting it as a CommonJS module. `baseAssign` is a low-level utility responsible for shallowly assigning enumerable own properties from source objects to a destination object, serving as a building block for higher-level Lodash methods like `_.assign`. Published in 2015, this specific package is tied to an end-of-life major version of Lodash (v3.x, supported until January 2016). While Lodash (currently v4.x) remains actively maintained with a continuous release cadence, this individual internal module is not independently updated. Modern best practices for consuming Lodash functions involve importing directly from the main `lodash` package (e.g., `require('lodash/assign')` or `import assign from 'lodash/assign'`) or utilizing `lodash-es` with tree-shaking bundlers to optimize bundle size. Per-method packages like this one are discouraged and are slated for removal in Lodash v5.

npm install lodash._baseassign
INSTALL
IMPORT
SIG · LODASH._BASEASSIGN
L
lodash._baseassign
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.

baseAssign
const baseAssign = require('lodash._baseassign');
import { baseAssign } = from 'lodash._baseassign';
This package is CommonJS-only and tied to Lodash v3.x. Native ES module imports are not supported. For modern applications, prefer `import assign from 'lodash/assign'` from the main `lodash` package or `lodash-es` for tree-shaking.

This code demonstrates how to `require` and use the `baseAssign` function for shallow property assignment. It also highlights that `baseAssign` is an internal, low-level utility, contrasting its usage with the public `_.assign` method from the main Lodash library.

const baseAssign = require('lodash._baseassign'); const target = { a: 1 }; const source1 = { b: 2 }; const source2 = { c: 3, a: 4 }; // 'a' will be overwritten by source1 if applied first // baseAssign is internal and typically takes a single source const result = baseAssign(target, source1); console.log('Result after baseAssign(target, source1):', result); // Expected: { a: 1, b: 2 } const anotherTarget = {}; const sourceObj = { propA: 1, propB: { nested: true } }; const assignedObj = baseAssign(anotherTarget, sourceObj); console.log('Assigned object:', assignedObj); console.log('Is it a shallow copy?', assignedObj.propB === sourceObj.propB); // Should be true // Demonstrate its internal nature: it's not a public _.assign // For multiple sources or customizers, use _.assign from the main lodash package. const _ = require('lodash'); // Using the main lodash package for comparison const finalObject = _.assign({}, {x: 1}, {y: 2}, {x: 3}); console.log('Result using _.assign from main lodash:', finalObject);
Debug
Known issues
breakingThis package is based on Lodash v3.2.0, an End-of-Life (EOL) version. Many APIs, behaviors, and internal structures changed significantly in Lodash v4.x, which was released in 2016. Code written for v3.x is unlikely to be directly compatible with v4.x equivalents without migration.
fix
Migrate to Lodash v4.x by installing `lodash` (the main package). Use `require('lodash/assign')` or `import assign from 'lodash/assign'` instead of `lodash._baseassign`. Consult the Lodash v3 to v4 migration guide.
affects: >=3.0.0
deprecatedUsing granular internal modules like `lodash._baseassign` is strongly discouraged by the Lodash team. These packages are considered legacy, can increase `node_modules` size, and are planned for removal in Lodash v5.
fix
Use specific methods directly from the main `lodash` package (e.g., `require('lodash/assign')` for CommonJS or `import assign from 'lodash/assign'` for ESM with `lodash-es`) or use bundler plugins (like `babel-plugin-lodash`) for optimized builds.
affects: >=3.0.0
gotchaThis package is CommonJS-only, meaning it cannot be directly imported using ES module `import` syntax (`import { baseAssign } from 'lodash._baseassign'`). Attempting to do so will result in runtime errors.
fix
In CommonJS environments, use `const baseAssign = require('lodash._baseassign');`. For ES module environments, you will need to rely on a CommonJS interop layer or, preferably, use `lodash-es` or `lodash/assign` from the main `lodash` package.
affects: >=3.0.0
breakingAs an EOL version (v3.x), `lodash._baseassign` is no longer supported and will not receive security patches for newly discovered vulnerabilities. While the provided advisories mention v4.x vulnerabilities, similar issues could exist in older codebases.
fix
Upgrade to the latest stable version of the main `lodash` package (currently v4.x) to ensure you receive critical security updates.
affects: >=3.0.0
Errors
Common errors & fixes
baseAssign is not a function
Attempting to use `import { baseAssign } from 'lodash._baseassign'` in an ES module environment, or `require` with a non-existent path. This package only exports `baseAssign` as a default CommonJS export.
fix
For CommonJS, use `const baseAssign = require('lodash._baseassign');`. For ESM, you must use a CommonJS interop layer or, better yet, migrate to `import assign from 'lodash/assign'` from the main `lodash` package.
TypeError: baseAssign is not a constructor
Trying to instantiate `baseAssign` with `new`, which is not a constructor function.
fix
`baseAssign` is a utility function and should be called directly, e.g., `baseAssign({}, source)`.
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