Skip to content

Commit d56c654

Browse files
committed
fix(integrityStream): dedupe algorithms to generate
1 parent e3845d5 commit d56c654

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,12 @@ function integrityStream (opts) {
249249
const algorithm = goodSri && sri.pickAlgorithm(opts)
250250
const digests = goodSri && sri[algorithm]
251251
// Calculating stream
252-
const algorithms = (opts.algorithms || ['sha512'])
253-
.concat(algorithm ? [algorithm] : [])
252+
const algorithms = Array.from(
253+
new Set(
254+
(opts.algorithms || ['sha512'])
255+
.concat(algorithm ? [algorithm] : [])
256+
)
257+
)
254258
const hashes = algorithms.map(crypto.createHash)
255259
let streamSize = 0
256260
const stream = new Transform({

0 commit comments

Comments
 (0)