Skip to content

Commit 4a2d189

Browse files
author
John Haley
committed
Fix shallowClone
`shallowClone` was expecting an additional object as the first parameter on which it would then place the keys for all objects passed into the function. Now it just creates that object internally and returns that value.
1 parent b08bf86 commit 4a2d189

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/utils/shallow_clone.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
var NodeGit = require("../../");
22

3-
function shallowClone(obj) {
4-
var merges = Array.prototype.slice.call(arguments, 1);
3+
function shallowClone() {
4+
var merges = Array.prototype.slice.call(arguments);
55

66
return merges.reduce(function(obj, merge) {
77
return Object.keys(merge).reduce(function(obj, key) {
88
obj[key] = merge[key];
99
return obj;
1010
}, obj);
11-
}, obj || {});
11+
}, {});
1212
}
1313

1414
NodeGit.Utils.shallowClone = module.exports = shallowClone;

0 commit comments

Comments
 (0)