summaryrefslogtreecommitdiff
path: root/lib/events.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events.js')
-rw-r--r--lib/events.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/events.js b/lib/events.js
index 06fed54c61..51259e6821 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -22,7 +22,6 @@
'use strict';
const {
- Array,
Boolean,
Error,
MathMin,
@@ -613,9 +612,11 @@ function arrayClone(arr) {
}
function unwrapListeners(arr) {
- const ret = new Array(arr.length);
+ const ret = arrayClone(arr);
for (let i = 0; i < ret.length; ++i) {
- ret[i] = arr[i].listener || arr[i];
+ const orig = ret[i].listener;
+ if (typeof orig === 'function')
+ ret[i] = orig;
}
return ret;
}