@ac-essentials/misc-util
    Preparing search index...

    Function defaults

    • Assign default options to an object.

      The first argument has the highest priority, the last argument the lowest. Only properties that are undefined in the target object will be assigned from the source objects.

      This is equivalent to _.defaults from Lodash.

      Type Parameters

      • R extends object
      • P extends Partial<R> = Partial<R>

      Parameters

      • ...args: [...(undefined | P)[], R]

        The objects to merge.

      Returns R

      The merged object.

      const options = defaults(
      { a: 1 },
      { a: 2, b: 2 },
      { a: 3, b: 3, c: 3 }
      );

      console.log(options); // { a: 1, b: 2, c: 3 }