export function isEmail(email) {
  const regex = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/;
  return regex.test(email);
}

export function isEmpty(value) {
  if (typeof value === 'object') {
    return Object.keys(value).length === 0 && value.constructor === Object;
  }
  return !value;
}

/**
* Converts an object to a query string.
*/
export function toQueryString(params) {
  return '?' + Object.entries(params)
    .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
    .join('&');
}
