export const urlParams = (paramsString) => {
    let result = {};
    const params = paramsString.split('?')[1];
    if (params && params !== '') {
        result = params.split('&').reduce(function (res, item) {
            const parts = item.split('=');
            res[parts[0]] = parts[1];
            return res;
        }, {});
    }
    return result;
}
let remoteHost = '#';
if (process.env.NODE_ENV === 'development') {
    remoteHost = 'http://localhost/api/index.php';
} else {
    remoteHost = 'http://trippest.mycht.cn/api/index.php';
}
export const HOST_NAME = remoteHost;

export function isNotEmpty(val) {
    return val !== undefined && val !== null && val !== '';
}

export function isEmpty(val) {
    return val === undefined || val === null || val === '';
}

export const getPathPart = (pathname, index) => {
    const ret = pathname.split('/');
    return ret[index] || '';
}
