Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function serializeMessage(destination, domain, obj) {
var _serialize;
return serialize(obj, (_serialize = {}, _serialize[TYPE.PROMISE] = function (val, key) {
return serializePromise(destination, domain, val, key);
}, _serialize[TYPE.FUNCTION] = function (val, key) {
return serializeFunction(destination, domain, val, key);
}, _serialize));
}
export function serializeMessage(destination : CrossDomainWindowType | ProxyWindow, domain : DomainMatcher, obj : T, { on, send } : { on : OnType, send : SendType }) : string {
return serialize(obj, {
[ TYPE.PROMISE ]: (val : Thenable, key : string) : SerializedPromise => serializePromise(destination, domain, val, key, { on, send }),
[ TYPE.FUNCTION ]: (val : Function, key : string) : SerializedFunction => serializeFunction(destination, domain, val, key, { on, send }),
[ TYPE.OBJECT ]: (val : CrossDomainWindowType) : Object | SerializedWindow => {
return (isWindow(val) || ProxyWindow.isProxyWindow(val)) ? serializeWindow(destination, domain, val, { on, send }) : val;
}
});
}