mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-22 11:40:10 +08:00
(feature) Add _.toPath
This commit is contained in:
@@ -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 {
|
||||
{
|
||||
|
||||
Vendored
+44
@@ -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 {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user