Back to Explore

sindresorhus/node-defaults

GitHub
1 watchersOpen source

Last release:

Provides a `defaults` helper to deeply merge user options with specified default values, returning a new object. Useful for filling in missing option fields (including nested objects) without mutating the inputs, and it includes protections like prototype pollution safeguards.

Project status

  • Actively maintained: yes, the upstream pushed on 2026-07-23, which is within a few weeks of today (2026-08-13), and that indicates recent attention to the repo.
  • Update cadence: very recent activity, at least one upstream push in late July 2026, but the published package updates in the provided history are otherwise from 2023, so there is not a clear regular release cadence shown here.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v3.0.0

    v3.0.0 makes the package require Node.js 18 instead of Node 16, and changes the implementation so that the provided options objects are no longer mutated. The core change is that both defaultOptions and options are deep-cloned before merging.

    Breaking
  • v2.0.2

    Release v2.0.2 updates the package metadata and focuses on TypeScript typing improvements. The only substantive code change is in the TypeScript declaration file, adjusting how merged types behave when the override value is undefined.

  • v2.0.1

    This release primarily updates package metadata. The version is bumped to 2.0.1 and the package.json repository field is corrected.

  • v2.0.0

    v2.0.0 converts the package to pure ESM, requires Node.js 16, and changes the merge behavior to support deep merging of options and defaults. The implementation also changes cloning semantics (only arrays and plain objects are cloned) and introduces additional merge logic around undefined values and key safety.

    BreakingSecurityFeatures
  • v1.0.4

    Release v1.0.4 is a very small update with no functional changes described in the provided release notes. The only stated change is an updated repository reference comparing v1.0.3 to v1.0.4.