File tree Expand file tree Collapse file tree 3 files changed +12
-18
lines changed Expand file tree Collapse file tree 3 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -633,17 +633,17 @@ exports.randomBytes = exports.pseudoRandomBytes = randomBytes;
633633
634634exports . rng = exports . prng = randomBytes ;
635635
636- exports . getCiphers = internalUtil . cachedResult ( ( ) => {
637- return internalUtil . filterDuplicateStrings ( getCiphers ( ) ) ;
638- } ) ;
636+ exports . getCiphers = internalUtil . cachedResult (
637+ ( ) => internalUtil . filterDuplicateStrings ( getCiphers ( ) )
638+ ) ;
639639
640- exports . getHashes = internalUtil . cachedResult ( ( ) => {
641- return internalUtil . filterDuplicateStrings ( getHashes ( ) ) ;
642- } ) ;
640+ exports . getHashes = internalUtil . cachedResult (
641+ ( ) => internalUtil . filterDuplicateStrings ( getHashes ( ) )
642+ ) ;
643643
644- exports . getCurves = internalUtil . cachedResult ( ( ) => {
645- return internalUtil . filterDuplicateStrings ( getCurves ( ) ) ;
646- } ) ;
644+ exports . getCurves = internalUtil . cachedResult (
645+ ( ) => internalUtil . filterDuplicateStrings ( getCurves ( ) )
646+ ) ;
647647
648648Object . defineProperty ( exports , 'fips' , {
649649 get : getFipsCrypto ,
Original file line number Diff line number Diff line change @@ -109,20 +109,14 @@ exports.assertCrypto = function(exports) {
109109// Filters duplicate strings. Used to support functions in crypto and tls
110110// modules. Implemented specifically to maintain existing behaviors in each.
111111exports . filterDuplicateStrings = function filterDuplicateStrings ( items , low ) {
112- if ( ! Array . isArray ( items ) )
113- return [ ] ;
114- const len = items . length ;
115- if ( len <= 1 )
116- return items ;
117112 const map = new Map ( ) ;
118- for ( var i = 0 ; i < len ; i ++ ) {
113+ for ( var i = 0 ; i < items . length ; i ++ ) {
119114 const item = items [ i ] ;
120115 const key = item . toLowerCase ( ) ;
121116 if ( low ) {
122117 map . set ( key , key ) ;
123118 } else {
124- if ( ! map . has ( key ) || map . get ( key ) <= item )
125- map . set ( key , item ) ;
119+ map . set ( key , item ) ;
126120 }
127121 }
128122 return Array . from ( map . values ( ) ) . sort ( ) ;
Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ const ciphers = crypto.getCiphers();
312312for ( const i in TEST_CASES ) {
313313 const test = TEST_CASES [ i ] ;
314314
315- if ( ciphers . indexOf ( test . algo ) === - 1 ) {
315+ if ( ! ciphers . includes ( test . algo ) ) {
316316 common . skip ( 'unsupported ' + test . algo + ' test' ) ;
317317 continue ;
318318 }
You can’t perform that action at this time.
0 commit comments