Function update

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • R

    Parameters

    • source: T

      source, in which the nested value should be removed.

    • path: [K1]

      path array of the nested value in the source

    • updateFn: ((value: T[K1]) => R)
        • (value: T[K1]): R
        • Parameters

          • value: T[K1]

          Returns R

    Returns Update1<T, K1, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • R

    Parameters

    • source: T

      source, in which the nested value should be removed.

    • path: [K1, K2]

      path array of the nested value in the source

    • updateFn: ((value: T[K1][K2]) => R)
        • (value: T[K1][K2]): R
        • Parameters

          • value: T[K1][K2]

          Returns R

    Returns Update2<T, K1, K2, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • R

    Parameters

    • source: T

      source, in which the nested value should be removed.

    • path: [K1, K2, K3]

      path array of the nested value in the source

    • updateFn: ((value: T[K1][K2][K3]) => R)
        • (value: T[K1][K2][K3]): R
        • Parameters

          • value: T[K1][K2][K3]

          Returns R

    Returns Update3<T, K1, K2, K3, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • K4 extends string | number | symbol

    • R

    Parameters

    • source: T

      source, in which the nested value should be removed.

    • path: [K1, K2, K3, K4]

      path array of the nested value in the source

    • updateFn: ((value: T[K1][K2][K3][K4]) => R)
        • (value: T[K1][K2][K3][K4]): R
        • Parameters

          • value: T[K1][K2][K3][K4]

          Returns R

    Returns Update4<T, K1, K2, K3, K4, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • K4 extends string | number | symbol

    • K5 extends string | number | symbol

    • R

    Parameters

    • source: T

      source, in which the nested value should be removed.

    • path: [K1, K2, K3, K4, K5]

      path array of the nested value in the source

    • updateFn: ((value: T[K1][K2][K3][K4][K5]) => R)
        • (value: T[K1][K2][K3][K4][K5]): R
        • Parameters

          • value: T[K1][K2][K3][K4][K5]

          Returns R

    Returns Update5<T, K1, K2, K3, K4, K5, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • R

    Parameters

    • source: Optional<T>

      source, in which the nested value should be removed.

    • path: [K1]

      path array of the nested value in the source

    • updateFn: ((value: undefined | T[K1]) => R)
        • (value: undefined | T[K1]): R
        • Parameters

          • value: undefined | T[K1]

          Returns R

    Returns Update1<T, K1, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • R

    Parameters

    • source: Optional<T>

      source, in which the nested value should be removed.

    • path: [K1, K2]

      path array of the nested value in the source

    • updateFn: ((value: undefined | Exclude<T[K1], undefined | null>[K2]) => R)
        • (value: undefined | Exclude<T[K1], undefined | null>[K2]): R
        • Parameters

          • value: undefined | Exclude<T[K1], undefined | null>[K2]

          Returns R

    Returns Update2<T, K1, K2, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • R

    Parameters

    • source: Optional<T>

      source, in which the nested value should be removed.

    • path: [K1, K2, K3]

      path array of the nested value in the source

    • updateFn: ((value: undefined | Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3]) => R)
        • (value: undefined | Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3]): R
        • Parameters

          • value: undefined | Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3]

          Returns R

    Returns Update3<T, K1, K2, K3, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • K4 extends string | number | symbol

    • R

    Parameters

    • source: Optional<T>

      source, in which the nested value should be removed.

    • path: [K1, K2, K3, K4]

      path array of the nested value in the source

    • updateFn: ((value: undefined | Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4]) => R)
        • (value: undefined | Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4]): R
        • Parameters

          • value: undefined | Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4]

          Returns R

    Returns Update4<T, K1, K2, K3, K4, R>

  • Updates the value on the specified path in source value using update function. This function will take current value and can transform it to other value (with the same type).

    If the path in the source doesn't exist, it will be created. Note, that we don't know what is the type of the object at runtime. Due to this, if the path value is number, we create an array, otherwise object.

    Source value can be nullable or undefinable, and path is treated as if the source (and all intermediate) values are required (because nullable and undefinable types can't have keys).

    Path supports up to 5 elements. This means, you are not able to use this helper if you need more.

    Return type will be the same as the source type, where any optional values along the path are made required (because they are created).

    Returns

    source value with removed value

    Type Parameters

    • T

    • K1 extends string | number | symbol

    • K2 extends string | number | symbol

    • K3 extends string | number | symbol

    • K4 extends string | number | symbol

    • K5 extends string | number | symbol

    • R

    Parameters

    • source: Optional<T>

      source, in which the nested value should be removed.

    • path: [K1, K2, K3, K4, K5]

      path array of the nested value in the source

    • updateFn: ((value: undefined | Exclude<Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4], undefined | null>[K5]) => R)
        • (value: undefined | Exclude<Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4], undefined | null>[K5]): R
        • Parameters

          • value: undefined | Exclude<Exclude<Exclude<Exclude<T[K1], undefined | null>[K2], undefined | null>[K3], undefined | null>[K4], undefined | null>[K5]

          Returns R

    Returns Update5<T, K1, K2, K3, K4, K5, R>

Generated using TypeDoc