From d56c6541c6dff9ae68267925ddd11e6590389a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Fri, 16 Feb 2018 14:35:26 -0800 Subject: [PATCH] fix(integrityStream): dedupe algorithms to generate --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 43c1507..8527433 100644 --- a/index.js +++ b/index.js @@ -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({