Skip to content

Commit 1a22395

Browse files
committed
Inline & simplify the node 8 extend workaround in evaluateSnippets.
1 parent 425dc4d commit 1a22395

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

lib/evaluateSnippets.js

+5-13
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ try {
2626
};
2727
}
2828

29-
function extend(target) {
30-
for (var i = 1; i < arguments.length; i += 1) {
31-
var source = arguments[i];
32-
for (const key of Object.keys(source)) {
33-
target[key] = source[key];
34-
}
35-
}
36-
return target;
37-
}
38-
3929
function isPromise(value) {
4030
return (
4131
value &&
@@ -65,7 +55,7 @@ function getErrorMessage(expect, format, error) {
6555
}
6656

6757
module.exports = async function(snippets, options) {
68-
var oldGlobal = extend({}, global);
58+
var oldGlobal = Object.assign({}, global);
6959
var expect = createExpect(options);
7060
global.expect = expect.clone();
7161
global.require = require;
@@ -149,6 +139,8 @@ module.exports = async function(snippets, options) {
149139
}
150140
}
151141

152-
// local function used for compatibility with node 8
153-
extend(global, oldGlobal);
142+
// inline function used for compatibility with node 8
143+
for (const key of Object.keys(oldGlobal)) {
144+
global[key] = oldGlobal[key];
145+
}
154146
};

0 commit comments

Comments
 (0)