Skip to content

Commit 0add7a8

Browse files
authored
tls: refactor to use validateFunction
Use validateFunction to remove duplicate implementation. Plus, remove `assert()` statement because validateFunction has the same purpose. PR-URL: #49422 Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Debadree Chatterjee <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent ea32c3c commit 0add7a8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/_tls_wrap.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
834834
ssl.handshakes = 0;
835835

836836
if (options.ALPNCallback) {
837-
if (typeof options.ALPNCallback !== 'function') {
838-
throw new ERR_INVALID_ARG_TYPE('options.ALPNCallback', 'Function', options.ALPNCallback);
839-
}
840-
assert(typeof options.ALPNCallback === 'function');
837+
validateFunction(options.ALPNCallback, 'options.ALPNCallback');
841838
this[kALPNCallback] = options.ALPNCallback;
842839
ssl.ALPNCallback = callALPNCallback;
843840
ssl.enableALPNCb();

0 commit comments

Comments
 (0)