UNPKG

@genexus/web-standard-functions

Version:

GeneXus JavaScript standard functions library for web generators

30 lines 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sweepObjectToClass = void 0; const gxcollection_1 = require("../gxcollection"); const fixTypeToClass_1 = require("./fixTypeToClass"); const getClassPropertyDefault_1 = require("./getClassPropertyDefault"); const objectToClass_1 = require("./objectToClass"); const sweepObjectToClass = (obj, inst) => { for (const pty of Object.keys(obj)) { if (obj[pty] === null || obj[pty] === undefined) { inst[pty] = obj[pty]; } else { const instPtyValue = (0, getClassPropertyDefault_1.getClassPropertyDefault)(inst, pty); if (typeof instPtyValue === "object") { let ptyType = instPtyValue.constructor; if (instPtyValue instanceof gxcollection_1.GxCollectionData) { ptyType = instPtyValue.itemClass; } inst[pty] = (0, objectToClass_1.objectToClass)(obj[pty], ptyType); } else { inst[pty] = (0, fixTypeToClass_1.fixTypeToClass)(obj[pty], inst[pty]); } } } return inst; }; exports.sweepObjectToClass = sweepObjectToClass; //# sourceMappingURL=sweepObjectToClass.js.map