Skip to content

Commit

Permalink
[Fix] utils.merge: functions should not be stringified into keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 22, 2024
1 parent 2a548a9 commit aa1f0a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var merge = function merge(target, source, options) {
return target;
}

if (typeof source !== 'object') {
if (typeof source !== 'object' && typeof source !== 'function') {
if (isArray(target)) {
target.push(source);
} else if (target && typeof target === 'object') {
Expand Down
4 changes: 2 additions & 2 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ test('merge()', function (t) {
func.bar = 'baz';
t.deepEqual(
utils.merge({ foo: 'bar' }, func),
{ foo: 'bar', 'function f() {}': true },
'functions can not be merge sources'
{ foo: 'bar', bar: 'baz' },
'functions can be merge sources'
);

t.test(
Expand Down

0 comments on commit aa1f0a8

Please sign in to comment.