Skip to content

Commit

Permalink
fix(integrityStream): dedupe algorithms to generate
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Feb 16, 2018
1 parent e3845d5 commit d56c654
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,12 @@ function integrityStream (opts) {
const algorithm = goodSri && sri.pickAlgorithm(opts)
const digests = goodSri && sri[algorithm]
// Calculating stream
const algorithms = (opts.algorithms || ['sha512'])
.concat(algorithm ? [algorithm] : [])
const algorithms = Array.from(
new Set(
(opts.algorithms || ['sha512'])
.concat(algorithm ? [algorithm] : [])
)
)
const hashes = algorithms.map(crypto.createHash)
let streamSize = 0
const stream = new Transform({
Expand Down

0 comments on commit d56c654

Please sign in to comment.