function route2data(stateParams, defaults) {
        if (defaults === undefined) {
            defaults = {};
        }

        let output = {};
        for (let [key, val] of Object.entries(stateParams)) {
            if (val === null || val === undefined) {
                output[key] = val;
            } else {
                if (typeof(val) === 'string') {
                    val = val.trim();
                }
                if (val === '-' || val === '') {
                    val = undefined;
                } else {
                    try {
                        val = JSON.parse(val);
                    } catch (err) {
                        if (!(err instanceof SyntaxError)) {
                            throw err;
                        }
                    }
                }

                output[key] = val;
            }
        }
        return output;
    }
/**
     * Convert the state / route parameters to an array, interpreting `undefined` values as `-`
     * @param {$stateParams} stateParams Object containing the route / state parameters
     * @param {Object} defaults Default values, if not provided in the route
     * @returns {Object} Object with the converted data
     */
Convert the state / route parameters to an array, interpreting `undefined` values as `-`
@param {$stateParams} stateParams Object containing the route / state parameters
@param {Object} defaults Default values, if not provided in the route
@returns {Object} Object with the converted data
Convert the state / route parameters to an array interpreting ` undefined ` values as ` - ` @param { $stateParams } stateParams Object containing the route / state parameters @param { Object } defaults Default values if not provided in the route @returns { Object } Object with the converted data
function route2data(stateParams, defaults) {
        if (defaults === undefined) {
            defaults = {};
        }
        let output = {};
        for (let [key, val] of Object.entries(stateParams)) {
            if (val === null || val === undefined) {
                output[key] = val;
            } else {
                if (typeof(val) === 'string') {
                    val = val.trim();
                }
                if (val === '-' || val === '') {
                    val = undefined;
                } else {
                    try {
                        val = JSON.parse(val);
                    } catch (err) {
                        if (!(err instanceof SyntaxError)) {
                            throw err;
                        }
                    }
                }
                output[key] = val;
            }
        }
        return output;
    }
function route2data ( stateParams , defaults ) { if ( defaults === undefined ) { defaults = { } ; } let output = { } ; for ( let [ key , val ] of Object . entries ( stateParams ) ) { if ( val === null || val === undefined ) { output [ key ] = val ; } else { if ( typeof ( val ) === 'string' ) { val = val . trim ( ) ; } if ( val === '-' || val === '' ) { val = undefined ; } else { try { val = JSON . parse ( val ) ; } catch ( err ) { if ( ! ( err instanceof SyntaxError ) ) { throw err ; } } } output [ key ] = val ; } } return output ; }
Convert the state / route parameters to an array, interpreting `undefined` values as `-`
 @param {$stateParams} stateParams Object containing the route / state parameters
 @param {Object} defaults Default values, if not provided in the route
 @returns {Object} Object with the converted data
Convert the state / route parameters to an array interpreting ` undefined ` values as ` - ` @param { $stateParams } stateParams Object containing the route / state parameters @param { Object } defaults Default values if not provided in the route @returns { Object } Object with the converted data