Home

function: toPath


toPath(value: *): Array

Converts `value` to a property path array.

Example(s):

toPath('a.b.c')
// => ['a', 'b', 'c']

toPath('a[0].b.c')
// => ['a', '0', 'b', 'c']

Params:

Name Type Attribute Description
value The value to convert.

Returns:

Array

  {
    "comment": "/**\r\n * Converts `value` to a property path array.\r\n *\r\n * @since 4.0.0\r\n * @category Util\r\n * @param {*} value The value to convert.\r\n * @returns {Array} Returns the new property path array.\r\n * @example\r\n *\r\n * toPath('a.b.c')\r\n * // => ['a', 'b', 'c']\r\n *\r\n * toPath('a[0].b.c')\r\n * // => ['a', '0', 'b', 'c']\r\n */",
    "meta": {
        "range": [
            555,
            722
        ],
        "filename": "toPath.js",
        "lineno": 22,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100010128",
            "name": "toPath",
            "type": "FunctionDeclaration",
            "paramnames": [
                "value"
            ]
        }
    },
    "description": "Converts `value` to a property path array.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Util",
            "value": "Util"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "The value to convert.",
            "name": "value"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Array"
                ]
            },
            "description": "Returns the new property path array."
        }
    ],
    "examples": [
        "toPath('a.b.c')\r// => ['a', 'b', 'c']\r\rtoPath('a[0].b.c')\r// => ['a', '0', 'b', 'c']"
    ],
    "name": "toPath",
    "longname": "toPath",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000927",
    "___s": true,
    "filepath": "toPath.js"
}