Script: more consistent input handling
This commit is contained in:
parent
7ad695e427
commit
929b8d2b62
1 changed files with 4 additions and 4 deletions
|
@ -6,10 +6,10 @@ var Network = require('./network')
|
||||||
var Opcode = require('./opcode')
|
var Opcode = require('./opcode')
|
||||||
|
|
||||||
function Script(data) {
|
function Script(data) {
|
||||||
this.buffer = data || []
|
data = data || []
|
||||||
if(!Array.isArray(this.buffer)) {
|
assert(Array.isArray(data), 'Expected Array, got ' + data)
|
||||||
throw new Error('expect Script to be initialized with Array, but got ' + data)
|
|
||||||
}
|
this.buffer = data
|
||||||
this.parse()
|
this.parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue