Allow _.mixin to accept a destination object as well as a source object.

Former-commit-id: 11ccb77653f017270c07579f59d75b847d4e6c65
This commit is contained in:
John-David Dalton
2013-07-18 08:12:14 -07:00
parent 9561414985
commit bb49b0c16a
3 changed files with 42 additions and 14 deletions

View File

@@ -2234,6 +2234,24 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.mixin');
(function() {
test('should accept an `object` argument', function() {
var lodash = {};
_.mixin(lodash, { 'a': function(a) { return a[0]; } });
strictEqual(lodash.a(['a']), 'a');
});
test('should accept a function `object` argument', function() {
var lodash = _.runInContext();
_.mixin(lodash, { 'a': function(a) { return a[0]; } });
strictEqual(lodash(['a']).a().value(), 'a');
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.omit');
(function() {