Skip to content

Replacements for deep merge packages

defu

If you need to deep merge two objects, you can use defu:

ts
import { defu } from 'defu'

const options = defu(object, defaults)

@fastify/deepmerge

The @fastify/deepmerge package is another fast and small alternative.

It also offers more options for customizing the merge behavior than other libraries.

ts
import deepMerge from '@fastify/deepmerge'

const options = deepMerge(object, defaults)

Released under the MIT License. (1f304c6e)