mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Merge 7ba63287e4
into 7c8be12d52
This commit is contained in:
commit
0242983229
1 changed files with 12 additions and 1 deletions
|
@ -7,6 +7,17 @@
|
||||||
import DishType from "./DishType.mjs";
|
import DishType from "./DishType.mjs";
|
||||||
import Utils from "../Utils.mjs";
|
import Utils from "../Utils.mjs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize Maps which are not natively compatible with JSON as an array of
|
||||||
|
* key-value-paris.
|
||||||
|
*/
|
||||||
|
function jsonStringifyReplacer(k, v) {
|
||||||
|
if (v instanceof Map) {
|
||||||
|
return [...v];
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translation methods for JSON dishes
|
* Translation methods for JSON dishes
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +28,7 @@ class DishJSON extends DishType {
|
||||||
*/
|
*/
|
||||||
static toArrayBuffer() {
|
static toArrayBuffer() {
|
||||||
DishJSON.checkForValue(this.value);
|
DishJSON.checkForValue(this.value);
|
||||||
this.value = this.value !== undefined ? Utils.strToArrayBuffer(JSON.stringify(this.value, null, 4)) : new ArrayBuffer;
|
this.value = this.value !== undefined ? Utils.strToArrayBuffer(JSON.stringify(this.value, jsonStringifyReplacer, 4)) : new ArrayBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue