Rename _.lateBind to _.bindKey. [closes #114]

Former-commit-id: 971e56cb86b5298ba2a9f92365f0463665d27230
This commit is contained in:
John-David Dalton
2012-11-17 00:06:55 -08:00
parent f2f980928b
commit 25e1eb3ce9
7 changed files with 192 additions and 192 deletions

View File

@@ -132,11 +132,11 @@
'after',
'bind',
'bindAll',
'bindKey',
'compose',
'debounce',
'defer',
'delay',
'lateBind',
'memoize',
'once',
'partial',
@@ -248,10 +248,10 @@
/** List of methods used by Underscore */
var underscoreMethods = _.without.apply(_, [allMethods].concat([
'bindKey',
'forIn',
'forOwn',
'isPlainObject',
'lateBind',
'merge',
'partial'
]));
@@ -402,7 +402,7 @@
func(1, noop);
} else if (methodName == 'bindAll') {
func({ 'noop': noop });
} else if (methodName == 'lateBind') {
} else if (methodName == 'bindKey') {
func(lodash, 'identity', array, string);
} else if (/^(?:bind|partial)$/.test(methodName)) {
func(noop, object, array, string);
@@ -711,10 +711,10 @@
_.each([
'assign',
'bindKey',
'forIn',
'forOwn',
'isPlainObject',
'lateBind',
'merge',
'partial'
], function(methodName) {

View File

@@ -213,6 +213,29 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.bindKey');
(function() {
test('should work when the target function is overwritten', function() {
var object = {
'name': 'moe',
'greet': function(greeting) {
return greeting + ': ' + this.name;
}
};
var func = _.bindKey(object, 'greet', 'hi');
equal(func(), 'hi: moe');
object.greet = function(greeting) {
return greeting + ' ' + this.name + '!';
};
equal(func(), 'hi moe!');
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.clone');
(function() {
@@ -1002,29 +1025,6 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.lateBind');
(function() {
test('should work when the target function is overwritten', function() {
var object = {
'name': 'moe',
'greet': function(greeting) {
return greeting + ': ' + this.name;
}
};
var func = _.lateBind(object, 'greet', 'hi');
equal(func(), 'hi: moe');
object.greet = function(greeting) {
return greeting + ' ' + this.name + '!';
};
equal(func(), 'hi moe!');
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.map');
(function() {