lodash: Fix _.has and _.result

This commit is contained in:
Felipe Barriga Richards
2015-08-17 14:50:12 -03:00
parent 832c51db81
commit 14394df181
2 changed files with 17 additions and 10 deletions
+6
View File
@@ -1571,6 +1571,10 @@ result = <void>_(any).noop(true, 'a', 1);
var object = {
'cheese': 'crumpets',
'one': 1,
'nested': {
'two': 2
},
'stuff': function () {
return 'nonsense';
}
@@ -1578,6 +1582,8 @@ var object = {
result = <string>_.result(object, 'cheese');
result = <string>_.result(object, 'stuff');
result = _.result<number>(object, 'one');
result = _.result<number>(object, ['nested', 'two'] );
var tempObject = {};
result = <typeof _>_.runInContext(tempObject);
+11 -10
View File
@@ -6810,13 +6810,12 @@ declare module _ {
//_.has
interface LoDashStatic {
/**
* Checks if the specified object property exists and is a direct property, instead of an
* inherited property.
* @param object The object to check.
* @param property The property to check for.
* @return True if key is a direct property, else false.
* Checks if path is a direct property.
* @param object The object to query.
* @param path The path to check.
* @return True if path is a direct property, else False.
**/
has(object: any, property: string): boolean;
has(object: any, path: string|string[]): boolean;
}
//_.invert
@@ -7822,12 +7821,14 @@ declare module _ {
/**
* Resolves the value of property on object. If property is a function it will be invoked with
* the this binding of object and its result returned, else the property value is returned. If
* object is falsey then undefined is returned.
* @param object The object to inspect.
* @param property The property to get the value of.
* object is false then undefined is returned.
* @param object The object to query.
* @param path The path of the property to resolve.
* @param defaultValue The value returned if the resolved value is undefined.
* @return The resolved value.
**/
result(object: any, property: string): any;
result<T>(object: any, path: string|string[], defaultValue?: T): T;
}
//_.runInContext