mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +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.
|
* @returns {Array} Returns the new property path array.
|
||||||
* @example
|
* @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) {
|
function toPath(value) {
|
||||||
return isArray(value) ? copyArray(value) : stringToPath(value);
|
return isArray(value) ? copyArray(value) : stringToPath(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user