mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
Added _.get definition to lodash with updated test file.
This commit is contained in:
@@ -922,6 +922,8 @@ result = <string[]>_.methods(_);
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).functions();
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).methods();
|
||||
|
||||
result = <number>_.get({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
interface FirstSecond {
|
||||
|
||||
16
lodash/lodash.d.ts
vendored
16
lodash/lodash.d.ts
vendored
@@ -5836,6 +5836,22 @@ declare module _ {
|
||||
methods(): _.LoDashArrayWrapper<string>;
|
||||
}
|
||||
|
||||
//_.get
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets the property value at path of object. If the resolved
|
||||
* value is undefined the defaultValue is used in its place.
|
||||
* @param object The object to query.
|
||||
* @param path The path of the property to get.
|
||||
* @param defaultValue The value returned if the resolved value is undefined.
|
||||
* @return Returns the resolved value.
|
||||
**/
|
||||
get<T>(object : Object,
|
||||
path:string|string[],
|
||||
defaultValue?:T
|
||||
): T;
|
||||
}
|
||||
|
||||
//_.has
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user