export function isTouchDevice() {
  return !!(typeof window === 'object' && (
    window.ontouchstart || navigator.maxTouchPoints
  ));
}

export function capitalizeFirstLetter(value) {
  return value.charAt(0).toUpperCase() + value.slice(1);
}

// got from https://gist.github.com/bgrins/6194623
export function isDataURL(s) {
  return !!s.match(isDataURL.regex);
}
isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; // eslint-disable-line

export function getInputProps(props) {
  const { input, ...resultProps } = props;
  return { ...resultProps, ...input };
}
