in Extensions/Optimizely/Src/UIContribution/lib/VSS.SDK.js [425:476]
var serializeMember = function (parentObject, newObject, key) {
var item;
try {
item = parentObject[key];
}
catch (ex) {
// Cannot access this property. Skip its serialization.
}
var itemType = typeof item;
if (itemType === "undefined") {
return;
}
// Check for a circular reference by looking at parent objects
var parentItemIndex = -1;
if (itemType === "object") {
parentItemIndex = parentObjects.originalObjects.indexOf(item);
}
if (parentItemIndex >= 0) {
// Circular reference found. Add reference to parent
var parentItem = parentObjects.newObjects[parentItemIndex];
if (!parentItem.__circularReferenceId) {
parentItem.__circularReferenceId = nextCircularRefId++;
}
newObject[key] = {
__circularReference: parentItem.__circularReferenceId
};
}
else {
if (itemType === "function") {
var proxyFunctionId = _this._nextProxyFunctionId++;
newObject[key] = {
__proxyFunctionId: _this._registerProxyFunction(item, obj),
__channelId: _this._channelId
};
}
else if (itemType === "object") {
if (item && item instanceof Date) {
newObject[key] = {
__proxyDate: item.getTime()
};
}
else {
newObject[key] = _this._customSerializeObject(item, settings, parentObjects, nextCircularRefId, depth + 1);
}
}
else if (key !== "__proxyFunctionId") {
// Just add non object/function properties as-is. Don't include "__proxyFunctionId" to protect
// our proxy methods from being invoked from other messages.
newObject[key] = item;
}
}
};