mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: changed _.invert() method
This commit is contained in:
@@ -1552,11 +1552,14 @@ result = <boolean>_({}).has(42);
|
||||
result = <boolean>_({}).has(true);
|
||||
result = <boolean>_({}).has(['', 42, true]);
|
||||
|
||||
interface FirstSecond {
|
||||
first: string;
|
||||
second: string;
|
||||
// _.invert
|
||||
{
|
||||
let result: TResult;
|
||||
result = _.invert<Object, TResult>({});
|
||||
result = _.invert<Object, TResult>({}, true);
|
||||
result = _({}).invert<TResult>().value();
|
||||
result = _({}).invert<TResult>(true).value();
|
||||
}
|
||||
result = <FirstSecond>_.invert({ 'first': 'moe', 'second': 'larry' });
|
||||
|
||||
// _.isEqual (alias: _.eq)
|
||||
result = <boolean>_.isEqual(1, 1);
|
||||
|
||||
Vendored
+15
-5
@@ -7190,11 +7190,21 @@ declare module _ {
|
||||
//_.invert
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an object composed of the inverted keys and values of the given object.
|
||||
* @param object The object to invert.
|
||||
* @return The created inverted object.
|
||||
**/
|
||||
invert(object: any): any;
|
||||
* Creates an object composed of the inverted keys and values of object. If object contains duplicate values,
|
||||
* subsequent values overwrite property assignments of previous values unless multiValue is true.
|
||||
*
|
||||
* @param object The object to invert.
|
||||
* @param multiValue Allow multiple values per key.
|
||||
* @return Returns the new inverted object.
|
||||
*/
|
||||
invert<T extends {}, TResult extends {}>(object: T, multiValue?: boolean): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.invert
|
||||
*/
|
||||
invert<TResult extends {}>(multiValue?: boolean): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.isEqual
|
||||
|
||||
Reference in New Issue
Block a user