[node-core-library] Remove lodash from production packages; add Objects.mergeWith and Objects.isRecord#5778
Merged
iclanton merged 6 commits intomicrosoft:mainfrom Apr 17, 2026
Merged
Conversation
iclanton
commented
Apr 16, 2026
octogonz
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
lodashas a runtime dependency from all production packages in this repo that were using it, replacing usages with native JavaScript equivalents or new utilities added to@rushstack/node-core-library.Two new utilities are added to the
Objectsnamespace innode-core-library:Objects.isRecord(value)— type guard that narrowsunknowntoRecord<string, unknown>(non-null, non-array object)Objects.mergeWith(target, source, customizer?)— recursive deep-merge modelled after lodash'smergeWith, with an optional customizer functionDetails
Packages affected:
@rushstack/node-core-library: AddedObjects.isRecord(inisRecord.ts) andObjects.mergeWith+Objects.MergeWithCustomizer(inmergeWith.ts), both exported from theObjectsnamespace. Unit tests added formergeWith.@microsoft/api-extractor: Replacedlodash.mergeWithwithObjects.mergeWithandlodash.cloneDeepwithstructuredClone(safe since the data is JSON-serializable and Node ≥ 18 is required).@rushstack/heft-jest-plugin: ReplacedlodashmergeWith/isObjectwithObjects.mergeWith/Objects.isRecord.@rushstack/npm-check-fork: Replaced_.extendwithObject.assign,_.haswithObject.prototype.hasOwnProperty.call, and a lodash chain with nativeObject.keys().filter().sort().@rushstack/localization-plugin-test-02(build test): Replacedlodash.escapewith a small inlinehtmlEscapehelper, since HTML escaping was the only usage.Test fixtures: References to
lodashas a stand-in package in Rush test fixtures (ProjectChangeAnalyzertests,repoWithCatalogs, sandbox repos, integration tests) were replaced withsemver, which is already in the dependency graph and serves the same stand-in purpose.No backwards-incompatible changes.
Objects.mergeWithandObjects.isRecordare new additions.How it was tested
heft buildpasses in all affected projects (node-core-library,api-extractor,heft-jest-plugin,npm-check-fork).Objects.mergeWithcover: target mutation, primitive overwrite, recursive plain-object merge, array overwrite (no index merge), null handling, empty objects, and customizer behaviour (return value, undefined fallback, argument passing, array concat, key enumeration, nested fallback).