Merge 881af4beee86b7ac93511be0061c652db212d9cf into 4290ea753912378913b1f3f54e0fc5720afeda5d
This commit is contained in:
commit
80ebac5f8d
@ -7,6 +7,17 @@
|
||||
import DishType from "./DishType.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
|
||||
*/
|
||||
@ -17,7 +28,7 @@ class DishJSON extends DishType {
|
||||
*/
|
||||
static toArrayBuffer() {
|
||||
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…
x
Reference in New Issue
Block a user