You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
470 B
25 lines
470 B
10 years ago
|
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;
|