Added _.get definition to lodash with updated test file.

This commit is contained in:
Sam Albert
2015-05-26 13:31:01 -04:00
parent f23cd55e31
commit 9f902efd35
2 changed files with 18 additions and 0 deletions

View File

@@ -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
View File

@@ -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 {
/**