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 @@ -637,17 +637,17 @@ exports.randomBytes = exports.pseudoRandomBytes = randomBytes;
637637
638638exports.rng = exports.prng = randomBytes;
639639
640- exports.getCiphers = internalUtil.cachedResult(() => {
641- return internalUtil.filterDuplicateStrings(getCiphers());
642- } );
640+ exports.getCiphers = internalUtil.cachedResult(
641+ () => internalUtil.filterDuplicateStrings(getCiphers())
642+ );
643643
644- exports.getHashes = internalUtil.cachedResult(() => {
645- return internalUtil.filterDuplicateStrings(getHashes());
646- } );
644+ exports.getHashes = internalUtil.cachedResult(
645+ () => internalUtil.filterDuplicateStrings(getHashes())
646+ );
647647
648- exports.getCurves = internalUtil.cachedResult(() => {
649- return internalUtil.filterDuplicateStrings(getCurves());
650- } );
648+ exports.getCurves = internalUtil.cachedResult(
649+ () => internalUtil.filterDuplicateStrings(getCurves())
650+ );
651651
652652Object.defineProperty(exports, 'fips', {
653653 get: getFipsCrypto,
Original file line number Diff line number Diff line change @@ -134,20 +134,14 @@ exports.normalizeEncoding = function normalizeEncoding(enc) {
134134// Filters duplicate strings. Used to support functions in crypto and tls
135135// modules. Implemented specifically to maintain existing behaviors in each.
136136exports.filterDuplicateStrings = function filterDuplicateStrings(items, low) {
137- if (!Array.isArray(items))
138- return [];
139- const len = items.length;
140- if (len <= 1)
141- return items;
142137 const map = new Map();
143- for (var i = 0; i < len ; i++) {
138+ for (var i = 0; i < items.length ; i++) {
144139 const item = items[i];
145140 const key = item.toLowerCase();
146141 if (low) {
147142 map.set(key, key);
148143 } else {
149- if (!map.has(key) || map.get(key) <= item)
150- map.set(key, item);
144+ map.set(key, item);
151145 }
152146 }
153147 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