mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Ported rest of Code ops & enabled/fixed some tests
This commit is contained in:
parent
ade056e881
commit
eb3a2502f5
14 changed files with 597 additions and 4 deletions
41
src/core/operations/JSONMinify.mjs
Normal file
41
src/core/operations/JSONMinify.mjs
Normal file
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import vkbeautify from "vkbeautify";
|
||||
import Operation from "../Operation";
|
||||
|
||||
/**
|
||||
* JSON Minify operation
|
||||
*/
|
||||
class JSONMinify extends Operation {
|
||||
|
||||
/**
|
||||
* JSONMinify constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "JSON Minify";
|
||||
this.module = "Code";
|
||||
this.description = "Compresses JavaScript Object Notation (JSON) code.";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
if (!input) return "";
|
||||
return vkbeautify.jsonmin(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default JSONMinify;
|
Loading…
Add table
Add a link
Reference in a new issue