summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-02-25 22:41:45 -0800
committerJames M Snell <jasnell@gmail.com>2017-03-17 11:09:16 -0700
commit5aa7d4daca98fd550ce4eec10e0bcb9e502b08d2 (patch)
tree28be507f2e7a0b2fc8d1915e919daf7b29c22867 /lib/_tls_wrap.js
parent910a8998fbcb35c70a8710aa90d32a581047afc7 (diff)
downloadandroid-node-v8-5aa7d4daca98fd550ce4eec10e0bcb9e502b08d2.tar.gz
android-node-v8-5aa7d4daca98fd550ce4eec10e0bcb9e502b08d2.tar.bz2
android-node-v8-5aa7d4daca98fd550ce4eec10e0bcb9e502b08d2.zip
tls: avoid using forEach
PR-URL: https://github.com/nodejs/node/pull/11582 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index f87a390dcc..e1767c5e67 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -321,12 +321,16 @@ var proxiedMethods = [
];
// Proxy HandleWrap, PipeWrap and TCPWrap methods
-proxiedMethods.forEach(function(name) {
- tls_wrap.TLSWrap.prototype[name] = function methodProxy(...args) {
+function makeMethodProxy(name) {
+ return function methodProxy(...args) {
if (this._parent[name])
return this._parent[name].apply(this._parent, args);
};
-});
+}
+for (var n = 0; n < proxiedMethods.length; n++) {
+ tls_wrap.TLSWrap.prototype[proxiedMethods[n]] =
+ makeMethodProxy(proxiedMethods[n]);
+}
tls_wrap.TLSWrap.prototype.close = function close(cb) {
let ssl;