Skip to content

Commit aa1f0a8

Browse files
committed
[Fix] utils.merge: functions should not be stringified into keys
1 parent 2a548a9 commit aa1f0a8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var merge = function merge(target, source, options) {
5050
return target;
5151
}
5252

53-
if (typeof source !== 'object') {
53+
if (typeof source !== 'object' && typeof source !== 'function') {
5454
if (isArray(target)) {
5555
target.push(source);
5656
} else if (target && typeof target === 'object') {

test/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ test('merge()', function (t) {
3838
func.bar = 'baz';
3939
t.deepEqual(
4040
utils.merge({ foo: 'bar' }, func),
41-
{ foo: 'bar', 'function f() {}': true },
42-
'functions can not be merge sources'
41+
{ foo: 'bar', bar: 'baz' },
42+
'functions can be merge sources'
4343
);
4444

4545
t.test(

0 commit comments

Comments
 (0)