Skip to content

Commit

Permalink
tls: refactor to use validateFunction
Browse files Browse the repository at this point in the history
Use validateFunction to remove duplicate implementation.
Plus, remove `assert()` statement because validateFunction
has the same purpose.

PR-URL: #49422
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
deokjinkim authored and UlisesGascon committed Sep 10, 2023
1 parent ca13841 commit 83fc4dc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
ssl.handshakes = 0;

if (options.ALPNCallback) {
if (typeof options.ALPNCallback !== 'function') {
throw new ERR_INVALID_ARG_TYPE('options.ALPNCallback', 'Function', options.ALPNCallback);
}
assert(typeof options.ALPNCallback === 'function');
validateFunction(options.ALPNCallback, 'options.ALPNCallback');
this[kALPNCallback] = options.ALPNCallback;
ssl.ALPNCallback = callALPNCallback;
ssl.enableALPNCb();
Expand Down

0 comments on commit 83fc4dc

Please sign in to comment.