Converts value to a property path array.
value
The value to convert.
Returns the new property path array.
_.toPath('a.b.c');// => ['a', 'b', 'c']_.toPath('a[0].b.c');// => ['a', '0', 'b', 'c']var path = ['a', 'b', 'c'], newPath = _.toPath(path);console.log(newPath);// => ['a', 'b', 'c']console.log(path === newPath);// => false Copy
_.toPath('a.b.c');// => ['a', 'b', 'c']_.toPath('a[0].b.c');// => ['a', '0', 'b', 'c']var path = ['a', 'b', 'c'], newPath = _.toPath(path);console.log(newPath);// => ['a', 'b', 'c']console.log(path === newPath);// => false
Converts
value
to a property path array.