mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Add _.toPath doc examples. [ci skip]
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -11464,6 +11464,20 @@
|
||||
* @returns {Array} Returns the new property path array.
|
||||
* @example
|
||||
*
|
||||
* _.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
|
||||
*/
|
||||
function toPath(value) {
|
||||
return isArray(value) ? copyArray(value) : stringToPath(value);
|
||||
|
||||
Reference in New Issue
Block a user