Function toPath

  • It will convert the provided property to an array of keys that'll represent the path of a value in an object.

    Type Parameters

    • Property extends PropertyKey

    Parameters

    Returns PathT<Property>

    Since

    1.0.0

    Example

    toPath(0);
    // => [0]

    Example

    toPath(Symbol());
    // => [Symbol()]

    Example

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

    Example

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