mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-11 20:50:02 +00:00
added _.findKey definitions
This commit is contained in:
@@ -546,6 +546,10 @@ var result = <any>_.cloneDeep(stoogesAges, function(value) {
|
||||
var foodDefaults = { 'name': 'apple' };
|
||||
result = <any>_.defaults(foodDefaults, { 'name': 'banana', 'type': 'fruit' });
|
||||
|
||||
result = <string>_.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
|
||||
var mergeNames = {
|
||||
'stooges': [
|
||||
{ 'name': 'moe' },
|
||||
|
||||
29
lodash/lodash.d.ts
vendored
29
lodash/lodash.d.ts
vendored
@@ -2206,6 +2206,35 @@ declare module _ {
|
||||
object: any,
|
||||
...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* This method is like _.findIndex except that it returns the key of the first element that
|
||||
* passes the callback check, instead of the element itself.
|
||||
* @param object The object to search.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return The key of the found element, else undefined.
|
||||
**/
|
||||
export function findKey(
|
||||
object: any,
|
||||
callback: (value: any) => boolean,
|
||||
thisArg?: any): string;
|
||||
|
||||
/**
|
||||
* @see _.findKey
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
export function findKey(
|
||||
object: any,
|
||||
pluckValue: string): string;
|
||||
|
||||
/**
|
||||
* @see _.findKey
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
export function findKey(
|
||||
object: any,
|
||||
whereValue: Dictionary<any>): string;
|
||||
|
||||
/**
|
||||
* Recursively merges own enumerable properties of the source object(s), that don't resolve
|
||||
* to undefined into the destination object. Subsequent sources will overwrite property
|
||||
|
||||
Reference in New Issue
Block a user