Skip to content

Commit 79e3f1c

Browse files
ruyadornoisaacs
authored andcommittedOct 3, 2019
chore: small readability refactor
This is a small refactor but made it much simpler the task of reading through the logic in these lines - also avoids some repetition. PR-URL: #16 Credit: @ruyadorno Close: #16 Reviewed-by: @isaacs
1 parent cdb4e48 commit 79e3f1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/content/read.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function withContentSri (cache, integrity, fn) {
177177
} else {
178178
// Can't use race here because a generic error can happen before a ENOENT error, and can happen before a valid result
179179
return Promise
180-
.all(sri[sri.pickAlgorithm()].map((meta) => {
180+
.all(digests.map((meta) => {
181181
return withContentSri(cache, meta, fn)
182182
.catch((err) => {
183183
if (err.code === 'ENOENT') {
@@ -233,7 +233,7 @@ function withContentSriSync (cache, integrity, fn) {
233233
return fn(cpath, digests[0])
234234
} else {
235235
let lastErr = null
236-
for (const meta of sri[sri.pickAlgorithm()]) {
236+
for (const meta of digests) {
237237
try {
238238
return withContentSriSync(cache, meta, fn)
239239
} catch (err) {

0 commit comments

Comments
 (0)
Please sign in to comment.