(feature) Add _.toPath

This commit is contained in:
DomiR
2016-01-23 14:52:57 +01:00
parent 0d6bd79475
commit fcb3ef9138
2 changed files with 67 additions and 0 deletions
+23
View File
@@ -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<string[]>;
result = _(true).toPath();
result = _(1).toPath();
result = _('a').toPath();
result = _([1]).toPath();
result = _<string>(["a"]).toPath();
result = _({}).toPath();
}
}
// _.uniqueId
module TestUniqueId {
{
+44
View File
@@ -15827,6 +15827,50 @@ declare module _ {
times(): LoDashExplicitArrayWrapper<number>;
}
//_.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<T, TWrapper> {
/**
* @see _.toPath
*/
toPath(): LoDashImplicitWrapper<string[]>;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.toPath
*/
toPath(): LoDashExplicitWrapper<string[]>;
}
//_.uniqueId
interface LoDashStatic {
/**