Skip to content

Commit ade541b

Browse files
committed
closes #1294
1 parent b2cedf7 commit ade541b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
function spy(func) {
22

33
function wrapper(...args) {
4+
// using ...args instead of arguments to store "real" array in wrapper.calls
45
wrapper.calls.push(args);
5-
return func.apply(this, arguments);
6+
return func.apply(this, args);
67
}
78

89
wrapper.calls = [];
910

1011
return wrapper;
11-
}
12+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Here we can use `calls.push(args)` to store all arguments in the log and `f.apply(this, args)` to forward the call.
1+
The wrapper returned by `spy(f)` should store all arguments and then use `f.apply` to forward the call.

0 commit comments

Comments
 (0)