Skip to content

Commit 5aa7d4d

Browse files
committed
tls: avoid using forEach
PR-URL: #11582 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 910a899 commit 5aa7d4d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/_tls_wrap.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,16 @@ var proxiedMethods = [
321321
];
322322

323323
// Proxy HandleWrap, PipeWrap and TCPWrap methods
324-
proxiedMethods.forEach(function(name) {
325-
tls_wrap.TLSWrap.prototype[name] = function methodProxy(...args) {
324+
function makeMethodProxy(name) {
325+
return function methodProxy(...args) {
326326
if (this._parent[name])
327327
return this._parent[name].apply(this._parent, args);
328328
};
329-
});
329+
}
330+
for (var n = 0; n < proxiedMethods.length; n++) {
331+
tls_wrap.TLSWrap.prototype[proxiedMethods[n]] =
332+
makeMethodProxy(proxiedMethods[n]);
333+
}
330334

331335
tls_wrap.TLSWrap.prototype.close = function close(cb) {
332336
let ssl;

0 commit comments

Comments
 (0)