• Fills the given target object or array with the provided new value at the specified key using dot notation. If the key is not found, the target object or array remains unchanged.

    Parameters

    • target: unknown

      The target object or array to fill.

    • key: string | number | string[]

      The key (in dot notation) or path where the new value should be filled.

    • newValue: any

      The new value to fill.

    Returns unknown

    The target object or array after filling with the new value.

    Example

    const object = {users: {name: ['Taylor', 'Otwell']}};
    dataFill(object, 'users.name.2', 'Abigail') // {users: {name: ['Taylor', 'Otwell', 'Abigail']}}

Generated using TypeDoc