mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Expose Dish (SyncDish) in API and make it composable.
This commit is contained in:
parent
f73452e01f
commit
f6c4b5073c
6 changed files with 66 additions and 13 deletions
|
@ -18,13 +18,13 @@ import * as ops from "./index";
|
|||
class SyncDish extends Dish {
|
||||
|
||||
/** */
|
||||
constructor(dish=null) {
|
||||
super(dish);
|
||||
|
||||
constructor(inputOrDish=null, type=null) {
|
||||
super(inputOrDish);
|
||||
|
||||
// Add operations to make it composable
|
||||
for (const op in ops) {
|
||||
this[op] = () => ops[op](this.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,7 @@ let code = `/**
|
|||
|
||||
|
||||
import "babel-polyfill";
|
||||
import SyncDish from "./SyncDish";
|
||||
import { wrap, help, bake } from "./api";
|
||||
import {
|
||||
`;
|
||||
|
@ -80,6 +81,7 @@ code += ` };
|
|||
|
||||
const chef = generateChef();
|
||||
chef.help = help;
|
||||
chef.dish = SyncDish;
|
||||
`;
|
||||
|
||||
includedOperations.forEach((op) => {
|
||||
|
@ -106,7 +108,7 @@ includedOperations.forEach((op) => {
|
|||
code += ` ${decapitalise(op)},\n`;
|
||||
});
|
||||
|
||||
|
||||
code += " SyncDish as Dish\n";
|
||||
code += "};\n";
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
|
||||
import "babel-polyfill";
|
||||
import SyncDish from "./SyncDish";
|
||||
import { wrap, help, bake } from "./api";
|
||||
import {
|
||||
ADD as core_ADD,
|
||||
|
@ -514,6 +515,7 @@ function generateChef() {
|
|||
|
||||
const chef = generateChef();
|
||||
chef.help = help;
|
||||
chef.dish = SyncDish;
|
||||
const ADD = chef.ADD;
|
||||
const AESDecrypt = chef.AESDecrypt;
|
||||
const AESEncrypt = chef.AESEncrypt;
|
||||
|
@ -1237,4 +1239,5 @@ export {
|
|||
XPathExpression,
|
||||
zlibDeflate,
|
||||
zlibInflate,
|
||||
SyncDish as Dish
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue