# unjs/defu

🌊 Assign default properties recursively

Repository: https://github.com/unjs/defu
Canonical: https://ross.abutalabs.com/products/defu
Language: TypeScript
License: MIT
License Family: permissive
Topics: node, npm, yarn, defaults, defaultsdeep
Last push: 2026-08-21T20:58:42+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 78, longevity 100
- inputs: {"age_days": 2764, "days_push": 12, "days_rel": 148, "gap_med": 2.5, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1358, forks 50 (observed 2026-08-28T04:04:29.681955+00:00)

## What it is
A tiny, fast TypeScript/JavaScript utility for recursively assigning default properties to objects without mutating inputs. It supports custom merging strategies and function-based default value manipulation.

## Use cases
- merge default options with user-provided config in a library
- recursively fill missing nested object properties
- create a custom deep merge strategy like summing numbers
- apply functions to transform default values during merge
- merge arrays and objects without mutating the originals

## When to choose
- you need lightweight recursive defaults assignment for JS/TS objects
- you want immutable merging with customizable strategies
- you're building a library or tool that accepts user options with sensible defaults

## When to avoid
- you need full deep-merge with array concatenation semantics by default
- you're working outside the JavaScript/TypeScript ecosystem
- you need schema validation alongside merging

## Facets
- artifact type: library
- maturity: stable
- function: serialization, developer-tools
- domain: developer-tools, web-development
- platform: browser, cross-platform
- tags: defaults, deep-merge, options-merging, typescript, unjs, javascript, nodejs

## Member repositories
- unjs/defu (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:29.681955+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:41:47.476739+00:00, confidence not recorded.
  - readme: https://github.com/unjs/defu (fetched 2026-08-28T04:04:29.681955+00:00, sha dca847b70b10)
  - registry_npm: https://registry.npmjs.org/defu (fetched 2026-08-29T12:00:09.769087+00:00, sha 00e2df2ecb97)
- Data as of 2026-08-30T08:39:29.467469+00:00.
