export function composeQueryParams(values) {
    const queryParams = values.map((value) => {
        if (value === values[0]) {
            return (value = `?${value}`);
        }
        else {
            return (value = `&${value}`);
        }
    });
    return queryParams.join('');
}
export const onFilterChange = (newFilters, params) => {
    const newParams = Object.assign({}, params);
    delete newParams.before_cursor;
    delete newParams.after_cursor;
    Object.keys(newFilters).forEach((key) => {
        if (newFilters[key].length) {
            newParams[key] = newFilters[key];
        }
        else {
            delete newParams[key];
        }
    });
    return newParams;
};
export const hasFilters = (params) => {
    const paginationKeys = ['after_cursor', 'before_cursor'];
    const paramKeys = Object.keys(params);
    const filterKeys = paramKeys.filter((paramKey) => !paginationKeys.includes(paramKey));
    return !!filterKeys.length;
};
