Add _.toPath doc examples. [ci skip]

This commit is contained in:
John-David Dalton
2015-09-05 10:00:08 -07:00
parent 650282b186
commit 7bb10d56f8

View File

@@ -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);