ESM: Added remaining ByteRepr operations.

This commit is contained in:
n1474335 2018-05-06 13:18:41 +01:00
parent 1f877817f4
commit be61419b80
11 changed files with 707 additions and 0 deletions

View file

@ -0,0 +1,49 @@
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
import Operation from "../Operation";
import Utils from "../Utils";
import {DELIM_OPTIONS} from "../lib/Delim";
/**
* To Decimal operation
*/
class ToDecimal extends Operation {
/**
* ToDecimal constructor
*/
constructor() {
super();
this.name = "To Decimal";
this.module = "Default";
this.description = "Converts the input data to an ordinal integer array.<br><br>e.g. <code>Hello</code> becomes <code>72 101 108 108 111</code>";
this.inputType = "byteArray";
this.outputType = "string";
this.args = [
{
"name": "Delimiter",
"type": "option",
"value": DELIM_OPTIONS
}
];
}
/**
* @param {byteArray} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const delim = Utils.charRep(args[0]);
return input.join(delim);
}
}
export default ToDecimal;