added _.partialRight definition

This commit is contained in:
Brian Zengel
2013-10-19 00:03:08 -04:00
parent 557389c808
commit a7b164dda6
2 changed files with 23 additions and 2 deletions
+10
View File
@@ -492,6 +492,16 @@ var greetPartial = function(greeting, name) { return greeting + ' ' + name; };
var hi = <Function>_.partial(greetPartial, 'hi');
hi('moe');
var defaultsDeep = <Function>_.partialRight(_['merge'], _.defaults);
var optionsPartialRight = {
'variable': 'data',
'imports': { 'jq': $ }
};
defaultsDeep(optionsPartialRight, _.templateSettings);
////////////////////////////////////////////////////////////////////////////////////////
//WHAT'S LEFT
////////////////////////////////////////////////////////////////////////////////////////
+13 -2
View File
@@ -1877,8 +1877,19 @@ declare module _ {
* @return The new partially applied function.
**/
export function partial(
fn: Function,
...arguments: any[]): Function;
func: Function,
...args: any[]): Function;
/**
* This method is like _.partial except that partial arguments are appended to those provided
* to the new function.
* @param func The function to partially apply arguments to.
* @param args Arguments to be partially applied.
* @return The new partially applied function.
**/
export function partialRight(
func: Function,
...args: any[]): Function;