From 9843a31b9c9ac075920b950f020bcf6a24a9a968 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Fri, 9 Nov 2018 16:10:33 +0700 Subject: [PATCH] Throw error if `outputs` isn't an array --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 497456e..b21144c 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,10 @@ const numberToUInt64 = number => { }; const buildOutputScript = outputs => { + if (!Array.isArray(outputs)) { + throw new TypeError(`Expected 'outputs' to be of type 'array', got: '${outputs}'.`); + } + let outputScript = [...numberToCompactSizeUInt(outputs.length)]; for (const [address, value] of outputs) {