Skip to content

toPath

js
_.toPath(value)

value 转换为属性路径数组。

¥Converts value to a property path array.

新增于

¥Since

4.0.0

参数

¥Arguments

  1. value (*):要转换的值。

    ¥value ()*: The value to convert.

返回

¥Returns

(数组):返回新的属性路径数组。

¥(Array): Returns the new property path array.

示例

¥Example

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

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

Lodash v4.17 中文网 - 粤ICP备13048890号