MCPcopy Create free account
hub / github.com/DanWahlin/CustomerManagerStandard / unwrapInstance

Function unwrapInstance

CustomerManager/Scripts/breeze.debug.js:14747–14777  ·  view source on GitHub ↗
(structObj, transformFn)

Source from the content-addressed store, hash-verified

14745
14746
14747 function unwrapInstance(structObj, transformFn) {
14748
14749 var rawObject = {};
14750 var stype = structObj.entityType || structObj.complexType;
14751 var serializerFn = getSerializerFn(stype);
14752 var unmapped = {};
14753 stype.dataProperties.forEach(function (dp) {
14754 if (dp.isComplexProperty) {
14755 rawObject[dp.nameOnServer] = __map(structObj.getProperty(dp.name), function (co) {
14756 return unwrapInstance(co, transformFn);
14757 });
14758 } else {
14759 var val = structObj.getProperty(dp.name);
14760 val = transformFn ? transformFn(dp, val) : val;
14761 if (val === undefined) return;
14762 val = serializerFn ? serializerFn(dp, val) : val;
14763 if (val !== undefined) {
14764 if (dp.isUnmapped) {
14765 unmapped[dp.nameOnServer] = __toJSONSafe(val);
14766 } else {
14767 rawObject[dp.nameOnServer] = val;
14768 }
14769 }
14770 }
14771 });
14772
14773 if (!__isEmpty(unmapped)) {
14774 rawObject.__unmapped = unmapped;
14775 }
14776 return rawObject;
14777 }
14778
14779 function unwrapOriginalValues(target, metadataStore, transformFn) {
14780 var stype = target.entityType || target.complexType;

Callers 1

unwrapChangedValuesFunction · 0.85

Calls 4

getSerializerFnFunction · 0.85
__mapFunction · 0.85
__toJSONSafeFunction · 0.85
__isEmptyFunction · 0.85

Tested by

no test coverage detected