Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "path"

Index

Functions

Const disallowProtoPath

  • disallowProtoPath(path: Path): string | number | ReadonlyArray<string | number>
  • Helper function to analyze given path using isProtoPath. Throws error if path contains __proto__.

    Parameters

    • path: Path

    Returns string | number | ReadonlyArray<string | number>

Const exists

  • exists(obj: any, path: Path): boolean
  • Takes an arbitrary object and lookup path. Descends into object along path and returns true if the full path exists (even if final leaf value is null or undefined). Checks are performed using hasOwnProperty().

    Parameters

    • obj: any

      -

    • path: Path

      -

    Returns boolean

Const isProtoPath

  • isProtoPath(path: Path): boolean
  • Helper function to analyze given lookup path for presence of __proto__. Returns true if the case.

    remarks

    Also see disallowProtoPath

    Parameters

    • path: Path

    Returns boolean

Const toPath

  • toPath(path: Path): NumOrString[]
  • Converts the given key path to canonical form (array).

    toPath("a.b.c");
    // ["a", "b", "c"]
    
    toPath(0)
    // [0]
    
    toPath(["a", "b", "c"])
    // ["a", "b", "c"]

    Parameters

    • path: Path

      -

    Returns NumOrString[]

Generated using TypeDoc