Skip to main content

deepMerge

Callable

  • deepMerge<T, V>(base: T, other?: V): T

  • Can be used to recursively merge objects and arrays, where values on the right-hand side will overwrite values on the left-hand based on the key or index respectively. Furthermore, if the 2nd argument is not provided, it will simply clone the base value.

    import { deepMerge } from '@boost/common';

    const obj = deepMerge({ foo: 123, bar: 'abc' }, { foo: 456, baz: true });

    // -> { foo: 456, bar: 'abc', baz: true }

    Type parameters