From 929b8d2b620a14844ba8299d45b410a9c1180635 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 5 May 2014 13:07:19 +1000 Subject: [PATCH] Script: more consistent input handling --- src/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script.js b/src/script.js index f672960..6fa6269 100644 --- a/src/script.js +++ b/src/script.js @@ -6,10 +6,10 @@ var Network = require('./network') var Opcode = require('./opcode') function Script(data) { - this.buffer = data || [] - if(!Array.isArray(this.buffer)) { - throw new Error('expect Script to be initialized with Array, but got ' + data) - } + data = data || [] + assert(Array.isArray(data), 'Expected Array, got ' + data) + + this.buffer = data this.parse() }