added _(...).bindKey def

This commit is contained in:
Brian Zengel
2013-10-20 23:33:30 -04:00
parent 4b57cabc9f
commit d97f8a126c
2 changed files with 23 additions and 1 deletions
+7 -1
View File
@@ -446,6 +446,9 @@ var view = {
view = _.bindAll(view);
jQuery('#docs').on('click', view.onClick);
view = _(view).bindAll().value();
jQuery('#docs').on('click', view.onClick);
var objectBindKey = {
'name': 'moe',
'greet': function(greeting) {
@@ -453,7 +456,7 @@ var objectBindKey = {
}
};
var funcBindKey: Function = _.bindKey(object, 'greet', 'hi');
var funcBindKey: Function = _.bindKey(objectBindKey, 'greet', 'hi');
funcBindKey();
objectBindKey.greet = function(greeting) {
@@ -462,6 +465,9 @@ objectBindKey.greet = function(greeting) {
funcBindKey();
funcBindKey = _(objectBindKey).bindKey('greet', 'hi').value();
funcBindKey();
var realNameMap = {
'curly': 'jerome'
};
+16
View File
@@ -1922,6 +1922,13 @@ declare module _ {
object: any,
...methodNames: string[]): any;
interface LoDashWrapper<T> {
/**
* @see _.bindAll
**/
bindAll(...methodNames: string[]): LoDashWrapper<any>;
}
/**
* Creates a function that, when called, invokes the method at object[key] and prepends any
* additional bindKey arguments to those provided to the bound function. This method differs
@@ -1937,6 +1944,15 @@ declare module _ {
key: string,
...args: any[]): Function;
interface LoDashWrapper<T> {
/**
* @see _.bindKey
**/
bindKey(
key: string,
...args: any[]): LoDashWrapper<Function>;
}
/**
* Creates a function that is the composition of the provided functions, where each function
* consumes the return value of the function that follows. For example, composing the functions