Skip to content

Commit 0380090

Browse files
committed
make utils.extend() returns the extended object
1 parent a701b9f commit 0380090

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ var utils = module.exports = {
8989
if (protective && obj[key]) continue
9090
obj[key] = ext[key]
9191
}
92+
return obj
9293
},
9394

9495
/**

test/unit/specs/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ describe('UNIT: Utils', function () {
137137
assert.strictEqual(a.b, b.b)
138138
})
139139

140+
it('should always return the extended object', function () {
141+
var a = {a: 1}, b = {a: {}, b: 2}
142+
assert.strictEqual(a, utils.extend(a, b))
143+
assert.strictEqual(a, utils.extend(a, undefined))
144+
})
145+
140146
})
141147

142148
describe('unique', function () {

0 commit comments

Comments
 (0)