Merge pull request #5761 from chrootsu/lodash-plant

lodash: added _.prototype.plant() method
This commit is contained in:
Masahiro Wakame
2015-09-20 18:43:10 +09:00
2 changed files with 66 additions and 0 deletions
+26
View File
@@ -546,6 +546,32 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
result = _({}).commit();
}
// _.prototype.plant
{
let result: _.LoDashWrapper<number>;
result = _(any).plant(42);
}
{
let result: _.LoDashStringWrapper;
result = _(any).plant('');
}
{
let result: _.LoDashWrapper<boolean>;
result = _(any).plant(true);
}
{
let result: _.LoDashNumberArrayWrapper;
result = _(any).plant([42]);
}
{
let result: _.LoDashArrayWrapper<any>;
result = _(any).plant<any>([]);
}
{
let result: _.LoDashObjectWrapper<{}>;
result = _(any).plant<{}>({});
}
/**************
* Collection *
**************/
+40
View File
@@ -2042,6 +2042,46 @@ declare module _ {
commit(): TWrapper;
}
//_.prototype.plant
interface LoDashWrapperBase<T, TWrapper> {
/**
* Creates a clone of the chained sequence planting value as the wrapped value.
* @param value The value to plant as the wrapped value.
* @return Returns the new lodash wrapper instance.
*/
plant(value: number): LoDashWrapper<number>;
/**
* @see _.plant
*/
plant(value: string): LoDashStringWrapper;
/**
* @see _.plant
*/
plant(value: boolean): LoDashWrapper<boolean>;
/**
* @see _.plant
*/
plant(value: number[]): LoDashNumberArrayWrapper;
/**
* @see _.plant
*/
plant<T>(value: T[]): LoDashArrayWrapper<T>;
/**
* @see _.plant
*/
plant<T extends {}>(value: T): LoDashObjectWrapper<T>;
/**
* @see _.plant
*/
plant(value: any): LoDashWrapper<any>;
}
/**************
* Collection *
**************/