Skip to content

Commit 646ee55

Browse files
jasnellitaloacasas
authored andcommitted
tls: avoid using forEach
PR-URL: #11582 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 5408301 commit 646ee55

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/_tls_wrap.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,16 @@ var proxiedMethods = [
300300
];
301301

302302
// Proxy HandleWrap, PipeWrap and TCPWrap methods
303-
proxiedMethods.forEach(function(name) {
304-
tls_wrap.TLSWrap.prototype[name] = function methodProxy(...args) {
303+
function makeMethodProxy(name) {
304+
return function methodProxy(...args) {
305305
if (this._parent[name])
306306
return this._parent[name].apply(this._parent, args);
307307
};
308-
});
308+
}
309+
for (var n = 0; n < proxiedMethods.length; n++) {
310+
tls_wrap.TLSWrap.prototype[proxiedMethods[n]] =
311+
makeMethodProxy(proxiedMethods[n]);
312+
}
309313

310314
tls_wrap.TLSWrap.prototype.close = function close(cb) {
311315
let ssl;

0 commit comments

Comments
 (0)