Defu is a lightweight and performant deep merge utility for JavaScript objects. It prioritizes source object properties, only applying defaults if a property is missing in the target. Unlike naive deep merges, Defu handles arrays intelligently, replacing them entirely instead of merging elements. This makes it excellent for merging configuration objects where preserving source values is paramount. Its simple API and minimal dependencies make it an efficient and reliable choice ensuring clean, predictable merges without unwanted side effects.
The npm package defu has seen varied release frequency since its initial release in February 2019. There were bursts of releases in 2020 and 2021, with periods of inactivity. Releases slowed down significantly after 2022 with only one release per year, eventually stopping in January 2024. There have been no releases in 2025 as of September 8th.
Defu's npm package downloads show consistent growth, escalating from 17 million in March 2024 to over 39 million in August 2025. September 2025 data is incomplete, showing only 9.4 million downloads, indicating a significantly lower projection if downloads maintain similar behaviour, or a decrease in popularity.