stringify-ipc-message-fn.js 360 B

123456789101112131415
  1. // Copyright 2019-2023 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. (function (message) {
  5. return JSON.stringify(message, (_k, val) => {
  6. if (val instanceof Map) {
  7. let o = {};
  8. val.forEach((v, k) => o[k] = v);
  9. return o;
  10. } else {
  11. return val;
  12. }
  13. })
  14. })