Dashboard sipadu mbip
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

toJSON.js 646B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toJSON;
  6. function toJSON(value, arg, ctx) {
  7. if (Array.isArray(value)) return value.map(function (v, i) {
  8. return toJSON(v, String(i), ctx);
  9. });
  10. if (value && typeof value.toJSON === 'function') {
  11. var anchor = ctx && ctx.anchors && ctx.anchors.find(function (a) {
  12. return a.node === value;
  13. });
  14. if (anchor) ctx.onCreate = function (res) {
  15. anchor.res = res;
  16. delete ctx.onCreate;
  17. };
  18. var res = value.toJSON(arg, ctx);
  19. if (anchor && ctx.onCreate) ctx.onCreate(res);
  20. return res;
  21. }
  22. return value;
  23. }