{"library":"lodash._baseassign","title":"Lodash Internal `baseAssign` Utility","description":"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.","language":"javascript","status":"abandoned","last_verified":"Tue Apr 21","install":{"commands":["npm install lodash._baseassign"],"cli":null},"imports":["const baseAssign = require('lodash._baseassign');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const baseAssign = require('lodash._baseassign');\n\nconst target = { a: 1 };\nconst source1 = { b: 2 };\nconst source2 = { c: 3, a: 4 }; // 'a' will be overwritten by source1 if applied first\n\n// baseAssign is internal and typically takes a single source\nconst result = baseAssign(target, source1);\nconsole.log('Result after baseAssign(target, source1):', result);\n// Expected: { a: 1, b: 2 }\n\nconst anotherTarget = {};\nconst sourceObj = { propA: 1, propB: { nested: true } };\nconst assignedObj = baseAssign(anotherTarget, sourceObj);\nconsole.log('Assigned object:', assignedObj);\nconsole.log('Is it a shallow copy?', assignedObj.propB === sourceObj.propB); // Should be true\n\n// Demonstrate its internal nature: it's not a public _.assign\n// For multiple sources or customizers, use _.assign from the main lodash package.\nconst _ = require('lodash'); // Using the main lodash package for comparison\nconst finalObject = _.assign({}, {x: 1}, {y: 2}, {x: 3});\nconsole.log('Result using _.assign from main lodash:', finalObject);","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}