From 7f99c0aed229f65ed237d79c09aa25498becff05 Mon Sep 17 00:00:00 2001 From: Daniel Furtado Date: Mon, 28 Dec 2015 18:40:21 +0100 Subject: [PATCH] Added optional default value property for the _.result function --- underscore/underscore.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index d4743c63a..87d5b0919 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1647,9 +1647,10 @@ interface UnderscoreStatic { * If the value of the named property is a function then invoke it; otherwise, return it. * @param object Object to maybe invoke function `property` on. * @param property The function by name to invoke on `object`. + * @param defaultValue The value to be returned in case `property` doesn't exist or is undefined. * @return The result of invoking the function `property` on `object. **/ - result(object: any, property: string): any; + result(object: any, property: string, defaultValue?:any): any; /** * Compiles JavaScript templates into functions that can be evaluated for rendering. Useful @@ -2561,7 +2562,7 @@ interface Underscore { * Wrapped type `object`. * @see _.result **/ - result(property: string): any; + result(property: string, defaultValue?:any): any; /** * Wrapped type `string`. @@ -3467,7 +3468,7 @@ interface _Chain { * Wrapped type `object`. * @see _.result **/ - result(property: string): _Chain; + result(property: string, defaultValue?:any): _Chain; /** * Wrapped type `string`.