mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: changed _.compact() method
This commit is contained in:
+12
-2
@@ -174,8 +174,18 @@ module TestChunk {
|
||||
result = _(list).chunk<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
// _.compact
|
||||
module TestCompact {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.compact<TResult>();
|
||||
result = _.compact<TResult>(array);
|
||||
result = _.compact<TResult>(list);
|
||||
result = _<TResult>(array).compact().value();
|
||||
result = _(list).compact<TResult>().value();
|
||||
}
|
||||
|
||||
// _.difference
|
||||
{
|
||||
|
||||
Vendored
+15
-12
@@ -349,26 +349,29 @@ declare module _ {
|
||||
//_.compact
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Returns a copy of the array with all falsy values removed. In JavaScript, false, null, 0, "",
|
||||
* undefined and NaN are all falsy.
|
||||
* @param array Array to compact.
|
||||
* @return (Array) Returns a new array of filtered values.
|
||||
**/
|
||||
compact<T>(array?: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.compact
|
||||
**/
|
||||
* Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are
|
||||
* falsey.
|
||||
*
|
||||
* @param array The array to compact.
|
||||
* @return (Array) Returns the new array of filtered values.
|
||||
*/
|
||||
compact<T>(array?: List<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.compact
|
||||
**/
|
||||
* @see _.compact
|
||||
*/
|
||||
compact(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.compact
|
||||
*/
|
||||
compact<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.difference
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user