/**
 * A function to create a sortBy compatible object from a string
 *
 * @export
 * @param {string} SortField
 * @param {string} Order
 * @returns {object}
 */
export function parseDynamicSortBy(SortField: string, Order: string) {
	// TODO: { [value.sort.toString()]: value.order.toString() }
	return JSON.parse(`{ "${SortField}": "${Order}" }`);
}

/**
 * Function to parse a string into a number or return undefined if it is not a number
 * Deprecated since all empty strings in bodys are now undefined. This happens in api/v1 router
 * @export
 * @param {string || any} data
 * @returns {object}
 */
export function parseIntOrUndefined(data: any) {
	return isNaN(parseInt(data)) ? undefined : parseInt(data);
}
