mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #4858 from dbeckwith/master
Fixes lodash contains searching keys instead of values on objects
This commit is contained in:
@@ -363,14 +363,19 @@ result = <string[]>_.at(['moe', 'larry', 'curly'], 0, 2);
|
||||
|
||||
result = <boolean>_.contains([1, 2, 3], 1);
|
||||
result = <boolean>_.contains([1, 2, 3], 1, 2);
|
||||
result = <boolean>_.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||
result = <boolean>_.contains({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40);
|
||||
result = <boolean>_.contains('curly', 'ur');
|
||||
|
||||
result = <boolean>_.include([1, 2, 3], 1);
|
||||
result = <boolean>_.include([1, 2, 3], 1, 2);
|
||||
result = <boolean>_.include({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||
result = <boolean>_.include({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40);
|
||||
result = <boolean>_.include('curly', 'ur');
|
||||
|
||||
result = <boolean>_.includes([1, 2, 3], 1);
|
||||
result = <boolean>_.includes([1, 2, 3], 1, 2);
|
||||
result = <boolean>_.includes({ 'moe': 30, 'larry': 40, 'curly': 67 }, 40);
|
||||
result = <boolean>_.includes('curly', 'ur');
|
||||
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function (num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function (num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<number>>_.countBy(['one', 'two', 'three'], 'length');
|
||||
|
||||
Vendored
+35
-3
@@ -2198,11 +2198,11 @@ declare module _ {
|
||||
/**
|
||||
* @see _.contains
|
||||
* @param dictionary The dictionary to iterate over.
|
||||
* @param key The key in the dictionary to search for.
|
||||
* @param value The value in the dictionary to search for.
|
||||
**/
|
||||
contains<T>(
|
||||
dictionary: Dictionary<T>,
|
||||
key: string,
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
@@ -2236,7 +2236,7 @@ declare module _ {
|
||||
**/
|
||||
include<T>(
|
||||
dictionary: Dictionary<T>,
|
||||
key: string,
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
@@ -2246,6 +2246,38 @@ declare module _ {
|
||||
searchString: string,
|
||||
targetString: string,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes<T>(
|
||||
collection: Array<T>,
|
||||
target: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes<T>(
|
||||
collection: List<T>,
|
||||
target: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes<T>(
|
||||
dictionary: Dictionary<T>,
|
||||
value: T,
|
||||
fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
**/
|
||||
includes(
|
||||
searchString: string,
|
||||
targetString: string,
|
||||
fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
//_.countBy
|
||||
|
||||
Vendored
+1
-2
@@ -2703,7 +2703,6 @@ declare module "sequelize"
|
||||
}
|
||||
|
||||
interface Lodash extends _.LoDashStatic {
|
||||
includes(str: string, needle: string): boolean;
|
||||
camelizeIf(str: string, condition: boolean): string;
|
||||
camelizeIf(str: string, condition: any): string;
|
||||
underscoredIf(str: string, condition: boolean): string;
|
||||
@@ -2785,4 +2784,4 @@ declare module "sequelize"
|
||||
var sequelize: sequelize.SequelizeStatic;
|
||||
|
||||
export = sequelize;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user