From 7bb10d56f8b4332067b33af6ecdbe4a408c4bcb0 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 5 Sep 2015 10:00:08 -0700 Subject: [PATCH] Add `_.toPath` doc examples. [ci skip] --- lodash.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lodash.js b/lodash.js index 35eebe3ab..d1f20b1f9 100644 --- a/lodash.js +++ b/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);