• Internal

    Merges properties from a new object into an existing object.

    This utility function performs a shallow merge, copying all enumerable properties from the new object to the old object. It's used internally to merge user-provided options with default configurations.

    Parameters

    • oldObject: object

      The target object to merge properties into

    • newObject: object

      The source object containing properties to merge

    Returns object

    The modified target object with merged properties

    Example

    const defaults = { color: 'blue', size: 40, opacity: 0.8 };
    const userOptions = { color: 'red', size: 60 };

    const merged = merge(defaults, userOptions);
    // Result: { color: 'red', size: 60, opacity: 0.8 }

    Example: Type-safe usage

    import { SetCaptchaOptions } from './constants';

    const defaultOptions: SetCaptchaOptions = { size: 40, color: 'blue' };
    const userOptions: Partial<SetCaptchaOptions> = { size: 60 };

    const result = merge(defaultOptions, userOptions) as SetCaptchaOptions;