Adds Octal functions

- To Octal
- From Octal
This commit is contained in:
Matt C 2017-03-14 21:26:10 +00:00
parent 94ea086e05
commit b8ce10ae96
4 changed files with 96 additions and 1 deletions

View file

@ -21,6 +21,11 @@ var ByteRepr = {
* @default
*/
HEX_DELIM_OPTIONS: ["Space", "Comma", "Semi-colon", "Colon", "Line feed", "CRLF", "0x", "\\x", "None"],
/**
* @constant
* @default
*/
OCT_DELIM_OPTIONS: ["Space", "Comma", "Semi-colon", "Colon", "Line feed", "CRLF"],
/**
* @constant
* @default
@ -53,6 +58,32 @@ var ByteRepr = {
},
/**
* To Oct operation.
*
* @author Matt C [matt@artemisbot.pw]
* @param {byteArray} input
* @param {Object[]} args
* @returns {string}
*/
runToOct: function(input, args) {
var delim = Utils.charRep[args[0] || "Space"];
return Utils.toOct(input, delim, 2);
},
/**
* From Oct operation.
*
* @author Matt C [matt@artemisbot.pw]
* @param {string} input
* @param {Object[]} args
* @returns {byteArray}
*/
runFromOct: function(input, args) {
var delim = Utils.charRep[args[0] || "Space"];
return Utils.fromOct(input, delim);
},
/**
* @constant
* @default