function sanitizeProperties()

in appcenter-analytics/Analytics.js [123:144]


function sanitizeProperties(props = null) {
    // Only string:string mappings are supported currently.

    const result = {};
    if (props === null) {
        return result;
    }
    Object.keys(props).filter((key) => props[key] !== null).forEach((key) => {
        switch (typeof props[key]) {
            case 'string':
            case 'number':
            case 'boolean':
                result[key] = `${props[key]}`;
                break;
            case 'undefined':
                break;
            default:
                throw new Error('Properties cannot be serialized. Object must only contain strings');
        }
    });
    return result;
}