Add inspect method to Opcode.

This commit is contained in:
Trevin Hofmann 2015-02-12 09:27:42 -06:00
parent fcd89b8dd7
commit 5bb750252d
1 changed files with 9 additions and 0 deletions

View File

@ -233,4 +233,13 @@ Opcode.isSmallIntOp = function(opcode) {
((opcode >= Opcode.map.OP_1) && (opcode <= Opcode.map.OP_16)));
};
/**
* Will return a string formatted for the console
*
* @returns {String} Script opcode
*/
Opcode.prototype.inspect = function() {
return '<Opcode: ' + this.toString() + ', hex: '+this.toHex()+', decimal: '+this.num+'>';
};
module.exports = Opcode;