Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "delete-in"

Index

Functions

deleteIn

  • deleteIn<T, A>(state: T, path: keyof [A]): Without<T, A>
  • deleteIn<T, A, B>(state: T, path: keyof [A, B]): Without2<T, A, B>
  • deleteIn<T, A, B, C>(state: T, path: keyof [A, B, C]): Without3<T, A, B, C>
  • deleteIn<T, A, B, C, D>(state: T, path: keyof [A, B, C, D]): Without4<T, A, B, C, D>
  • deleteIn<T, A, B, C, D, E>(state: T, path: keyof [A, B, C, D, E]): Without5<T, A, B, C, D, E>
  • deleteIn<T, A, B, C, D, E, F>(state: T, path: keyof [A, B, C, D, E, F]): Without6<T, A, B, C, D, E, F>
  • deleteIn<T, A, B, C, D, E, F, G>(state: T, path: keyof [A, B, C, D, E, F, G]): Without7<T, A, B, C, D, E, F, G>
  • deleteIn<T, A, B, C, D, E, F, G, H>(state: T, path: keyof [A, B, C, D, E, F, G, H]): Without8<T, A, B, C, D, E, F, G, H>
  • Uses updateIn and returns updated state with key for given path removed. Does not modify original state. Returns undefined if path is an empty string or array.

    remarks

    Only the first 8 path levels are type checked. The result type will have the path value removed too.

    See deleteInUnsafe for unchecked version.

    example
    // type checked
    deleteIn({ a: { b: { c: 23 } } }, ["a","b","c"]);
    
    // error (invalid path)
    deleteIn({ a: { b: { c: 23 } } }, ["a","b","d"]);

    Type parameters

    • T

    • A: Keys<T>

    Parameters

    • state: T

      -

    • path: keyof [A]

      -

    Returns Without<T, A>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    Parameters

    • state: T
    • path: keyof [A, B]

    Returns Without2<T, A, B>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    Parameters

    • state: T
    • path: keyof [A, B, C]

    Returns Without3<T, A, B, C>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    • D: Keys3<T, A, B, C>

    Parameters

    • state: T
    • path: keyof [A, B, C, D]

    Returns Without4<T, A, B, C, D>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    • D: Keys3<T, A, B, C>

    • E: Keys4<T, A, B, C, D>

    Parameters

    • state: T
    • path: keyof [A, B, C, D, E]

    Returns Without5<T, A, B, C, D, E>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    • D: Keys3<T, A, B, C>

    • E: Keys4<T, A, B, C, D>

    • F: Keys5<T, A, B, C, D, E>

    Parameters

    • state: T
    • path: keyof [A, B, C, D, E, F]

    Returns Without6<T, A, B, C, D, E, F>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    • D: Keys3<T, A, B, C>

    • E: Keys4<T, A, B, C, D>

    • F: Keys5<T, A, B, C, D, E>

    • G: Keys6<T, A, B, C, D, E, F>

    Parameters

    • state: T
    • path: keyof [A, B, C, D, E, F, G]

    Returns Without7<T, A, B, C, D, E, F, G>

  • Type parameters

    • T

    • A: Keys<T>

    • B: Keys1<T, A>

    • C: Keys2<T, A, B>

    • D: Keys3<T, A, B, C>

    • E: Keys4<T, A, B, C, D>

    • F: Keys5<T, A, B, C, D, E>

    • G: Keys6<T, A, B, C, D, E, F>

    • H: Keys7<T, A, B, C, D, E, F, G>

    Parameters

    • state: T
    • path: keyof [A, B, C, D, E, F, G, H]

    Returns Without8<T, A, B, C, D, E, F, G, H>

Const deleteInUnsafe

  • deleteInUnsafe(state: any, path: Path): any
  • Unchecked version of deleteIn. Path can be given as string or tuple.

    example
    // unchecked
    deleteIn({ a: { b: { c: 23 } } }, "a.b.c");
    // { a: { b: { } } }

    Parameters

    • state: any

      -

    • path: Path

      -

    Returns any

Generated using TypeDoc