function convertToPlainObject(value) {
    var newObj = value;
    if (isError$1(value)) {
        newObj = __assign$2({ message: value.message, name: value.name, stack: value.stack }, getOwnProperties(value));
    }
    else if (isEvent(value)) {
        var event_1 = value;
        newObj = __assign$2({ type: event_1.type, target: serializeEventTarget(event_1.target), currentTarget: serializeEventTarget(event_1.currentTarget) }, getOwnProperties(event_1));
        if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {
            newObj.detail = event_1.detail;
        }
    }
    return newObj;
}
Transforms any object into an object literal with all its attributes
attached to it.

@param value Initial source that we have to transform in order for it to be usable by the serializer