| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ef3d889 commit 797d9ee
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -633,17 +633,17 @@ exports.randomBytes = exports.pseudoRandomBytes = randomBytes; | |||
| 633 | 633 | ||
| 634 | 634 | exports.rng = exports.prng = randomBytes; | |
| 635 | 635 | ||
| 636 | - exports.getCiphers = internalUtil.cachedResult(() => { | ||
| 637 | - return internalUtil.filterDuplicateStrings(getCiphers()); | ||
| 638 | - }); | ||
| 636 | + exports.getCiphers = internalUtil.cachedResult( | ||
| 637 | + () => internalUtil.filterDuplicateStrings(getCiphers()) | ||
| 638 | + ); | ||
| 639 | 639 | ||
| 640 | - exports.getHashes = internalUtil.cachedResult(() => { | ||
| 641 | - return internalUtil.filterDuplicateStrings(getHashes()); | ||
| 642 | - }); | ||
| 640 | + exports.getHashes = internalUtil.cachedResult( | ||
| 641 | + () => internalUtil.filterDuplicateStrings(getHashes()) | ||
| 642 | + ); | ||
| 643 | 643 | ||
| 644 | - exports.getCurves = internalUtil.cachedResult(() => { | ||
| 645 | - return internalUtil.filterDuplicateStrings(getCurves()); | ||
| 646 | - }); | ||
| 644 | + exports.getCurves = internalUtil.cachedResult( | ||
| 645 | + () => internalUtil.filterDuplicateStrings(getCurves()) | ||
| 646 | + ); | ||
| 647 | 647 | ||
| 648 | 648 | Object.defineProperty(exports, 'fips', { | |
| 649 | 649 | get: getFipsCrypto, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,20 +109,14 @@ exports.assertCrypto = function(exports) { | |||
| 109 | 109 | // Filters duplicate strings. Used to support functions in crypto and tls | |
| 110 | 110 | // modules. Implemented specifically to maintain existing behaviors in each. | |
| 111 | 111 | exports.filterDuplicateStrings = function filterDuplicateStrings(items, low) { | |
| 112 | - if (!Array.isArray(items)) | ||
| 113 | - return []; | ||
| 114 | - const len = items.length; | ||
| 115 | - if (len <= 1) | ||
| 116 | - return items; | ||
| 117 | 112 | const map = new Map(); | |
| 118 | - for (var i = 0; i < len; i++) { | ||
| 113 | + for (var i = 0; i < items.length; i++) { | ||
| 119 | 114 | const item = items[i]; | |
| 120 | 115 | const key = item.toLowerCase(); | |
| 121 | 116 | if (low) { | |
| 122 | 117 | map.set(key, key); | |
| 123 | 118 | } else { | |
| 124 | - if (!map.has(key) || map.get(key) <= item) | ||
| 125 | - map.set(key, item); | ||
| 119 | + map.set(key, item); | ||
| 126 | 120 | } | |
| 127 | 121 | } | |
| 128 | 122 | 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 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments