Function objectPath

  • Get a value from an object using a path string.

    Parameters

    • object: Record<string, any>

      The object to get the value from.

    • oath: string

      The path string to use.

    • delimiter: string | RegExp

      The delimiter to use for splitting the path string.

    Returns Record<string, any>

    The value at the end of the path.

    objectPath({ a: { b: { c: 1 } } }, 'a/b/c', '/'); // 1