3 changed files with 36 additions and 1 deletions
@ -0,0 +1,24 @@ |
|||
var BufferReader = require('./bufferreader'); |
|||
var Opcode = require('./opcode'); |
|||
|
|||
var Script = function Script(buf) { |
|||
if (!(this instanceof Script)) |
|||
return new Script(buf); |
|||
|
|||
this.chunks = []; |
|||
|
|||
if (Buffer.isBuffer(buf)) { |
|||
this.parse(buf); |
|||
} |
|||
else if (typeof buf !== 'undefined') { |
|||
var obj = buf; |
|||
this.set(obj); |
|||
} |
|||
}; |
|||
|
|||
Script.prototype.set = function(obj) { |
|||
this.chunks = obj.chunks || this.chunks; |
|||
return this; |
|||
}; |
|||
|
|||
module.exports = Script; |
@ -0,0 +1,11 @@ |
|||
var Script = require('../lib/script'); |
|||
var should = require('chai').should(); |
|||
var Opcode = require('../lib/opcode'); |
|||
|
|||
describe('Script', function() { |
|||
|
|||
it('should make a new script', function() { |
|||
var script = new Script(); |
|||
}); |
|||
|
|||
}); |
Loading…
Reference in new issue