diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b43e4eb3c..0a356d90e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -9969,6 +9969,29 @@ module TestTimes { } } +// _.toPath +module TestToPath { + { + let result: string[]; + result = _.toPath(true); + result = _.toPath(1); + result = _.toPath('a'); + result = _.toPath(["a"]); + result = _.toPath({}); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(true).toPath(); + result = _(1).toPath(); + result = _('a').toPath(); + result = _([1]).toPath(); + result = _(["a"]).toPath(); + result = _({}).toPath(); + } +} + // _.uniqueId module TestUniqueId { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6126d16e7..097290c78 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -15827,6 +15827,50 @@ declare module _ { times(): LoDashExplicitArrayWrapper; } + //_.toPath + interface LoDashStatic { + /** + * Converts `value` to a property path array. + * + * @static + * @memberOf _ + * @category Util + * @param {*} value The value to convert. + * @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 + */ + toPath(value: any): string[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.toPath + */ + toPath(): LoDashExplicitWrapper; + } + //_.uniqueId interface LoDashStatic { /**