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>
This commit is contained in:
James M Snell committed 2017-03-17 11:09:16 -07:00
1 parent 910a8998fb
commit 5aa7d4daca
1 file changed
+7 -3
+7 -3
View File
@@ -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;