File tree 3 files changed +12
-18
lines changed
3 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -637,17 +637,17 @@ exports.randomBytes = exports.pseudoRandomBytes = randomBytes;
637
637
638
638
exports . rng = exports . prng = randomBytes ;
639
639
640
- exports . getCiphers = internalUtil . cachedResult ( ( ) => {
641
- return internalUtil . filterDuplicateStrings ( getCiphers ( ) ) ;
642
- } ) ;
640
+ exports . getCiphers = internalUtil . cachedResult (
641
+ ( ) => internalUtil . filterDuplicateStrings ( getCiphers ( ) )
642
+ ) ;
643
643
644
- exports . getHashes = internalUtil . cachedResult ( ( ) => {
645
- return internalUtil . filterDuplicateStrings ( getHashes ( ) ) ;
646
- } ) ;
644
+ exports . getHashes = internalUtil . cachedResult (
645
+ ( ) => internalUtil . filterDuplicateStrings ( getHashes ( ) )
646
+ ) ;
647
647
648
- exports . getCurves = internalUtil . cachedResult ( ( ) => {
649
- return internalUtil . filterDuplicateStrings ( getCurves ( ) ) ;
650
- } ) ;
648
+ exports . getCurves = internalUtil . cachedResult (
649
+ ( ) => internalUtil . filterDuplicateStrings ( getCurves ( ) )
650
+ ) ;
651
651
652
652
Object . defineProperty ( exports , 'fips' , {
653
653
get : getFipsCrypto ,
Original file line number Diff line number Diff line change @@ -134,20 +134,14 @@ exports.normalizeEncoding = function normalizeEncoding(enc) {
134
134
// Filters duplicate strings. Used to support functions in crypto and tls
135
135
// modules. Implemented specifically to maintain existing behaviors in each.
136
136
exports . filterDuplicateStrings = function filterDuplicateStrings ( items , low ) {
137
- if ( ! Array . isArray ( items ) )
138
- return [ ] ;
139
- const len = items . length ;
140
- if ( len <= 1 )
141
- return items ;
142
137
const map = new Map ( ) ;
143
- for ( var i = 0 ; i < len ; i ++ ) {
138
+ for ( var i = 0 ; i < items . length ; i ++ ) {
144
139
const item = items [ i ] ;
145
140
const key = item . toLowerCase ( ) ;
146
141
if ( low ) {
147
142
map . set ( key , key ) ;
148
143
} else {
149
- if ( ! map . has ( key ) || map . get ( key ) <= item )
150
- map . set ( key , item ) ;
144
+ map . set ( key , item ) ;
151
145
}
152
146
}
153
147
return Array . from ( map . values ( ) ) . sort ( ) ;
Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ const ciphers = crypto.getCiphers();
312
312
for ( const i in TEST_CASES ) {
313
313
const test = TEST_CASES [ i ] ;
314
314
315
- if ( ciphers . indexOf ( test . algo ) === - 1 ) {
315
+ if ( ! ciphers . includes ( test . algo ) ) {
316
316
common . skip ( 'unsupported ' + test . algo + ' test' ) ;
317
317
continue ;
318
318
}
You can’t perform that action at this time.
0 commit comments