mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
ESM: Added remaining ByteRepr operations.
This commit is contained in:
parent
1f877817f4
commit
be61419b80
11 changed files with 707 additions and 0 deletions
49
src/core/operations/ToDecimal.mjs
Normal file
49
src/core/operations/ToDecimal.mjs
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue