Dashboard sipadu mbip
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

toJSON.js 588B

1234567891011121314151617181920212223
  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((v, i) => toJSON(v, String(i), ctx));
  8. if (value && typeof value.toJSON === 'function') {
  9. const anchor = ctx && ctx.anchors && ctx.anchors.find(a => a.node === value);
  10. if (anchor) ctx.onCreate = res => {
  11. anchor.res = res;
  12. delete ctx.onCreate;
  13. };
  14. const res = value.toJSON(arg, ctx);
  15. if (anchor && ctx.onCreate) ctx.onCreate(res);
  16. return res;
  17. }
  18. return value;
  19. }