mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5117 from chrootsu/lodash-negate
lodash: added _.negate() method
This commit is contained in:
+14
-1
@@ -893,9 +893,22 @@ result = <string[]>result(1, true);
|
||||
result = <ModArgsResult>_<ModArgsFunc>((x: string, y: string) => [x, y]).modArgs<ModArgsResult>([modArgsFn1, modArgsFn2]).value();
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
// _.negate
|
||||
interface TestNegatePredicate {
|
||||
(a1: number, a2: number): boolean;
|
||||
}
|
||||
interface TestNegateResult {
|
||||
(a1: number, a2: number): boolean;
|
||||
}
|
||||
var testNegatePredicate = (a1: number, a2: number) => a1 > a2;
|
||||
result = <TestNegateResult>_.negate<TestNegatePredicate>(testNegatePredicate);
|
||||
result = <TestNegateResult>_.negate<TestNegatePredicate, TestNegateResult>(testNegatePredicate);
|
||||
result = <TestNegateResult>_(testNegatePredicate).negate().value();
|
||||
result = <TestNegateResult>_(testNegatePredicate).negate<TestNegateResult>().value();
|
||||
|
||||
var initialize = _.once(function () { });
|
||||
initialize();
|
||||
initialize();''
|
||||
initialize();
|
||||
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedOnce(4);
|
||||
|
||||
|
||||
Vendored
+28
@@ -5474,6 +5474,34 @@ declare module _ {
|
||||
modArgs<TResult>(transforms: Function[]): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.negate
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that negates the result of the predicate func. The func predicate is invoked with
|
||||
* the this binding and arguments of the created function.
|
||||
* @param predicate The predicate to negate.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
negate<T extends Function>(predicate: T): (...args: any[]) => boolean;
|
||||
|
||||
/**
|
||||
* @see _.negate
|
||||
*/
|
||||
negate<T extends Function, TResult extends Function>(predicate: T): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.negate
|
||||
*/
|
||||
negate(): LoDashObjectWrapper<(...args: any[]) => boolean>;
|
||||
|
||||
/**
|
||||
* @see _.negate
|
||||
*/
|
||||
negate<TResult extends Function>(): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.once
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user