Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ deprecated: v0.11.3
Deprecated predecessor of `console.log`.

### util.\_extend(obj)
### util.\_extend(target, source)
<!-- YAML
added: v0.7.5
deprecated: v6.0.0
Expand Down
12 changes: 6 additions & 6 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -983,16 +983,16 @@ exports.inherits = function(ctor, superCtor) {
Object.setPrototypeOf(ctor.prototype, superCtor.prototype);
};

exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (add === null || typeof add !== 'object') return origin;
exports._extend = function(target, source) {
// Don't do anything if source isn't an object
if (source === null || typeof source !== 'object') return target;

var keys = Object.keys(add);
var keys = Object.keys(source);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
target[keys[i]] = source[keys[i]];
}
return origin;
return target;
};

function hasOwnProperty(obj, prop) {
Expand Down