Skip to content

Instantly share code, notes, and snippets.

@zempo
Created July 20, 2023 16:53
Show Gist options
  • Save zempo/36b3298c7d4d6ac40e279e9e2d746cf0 to your computer and use it in GitHub Desktop.
Save zempo/36b3298c7d4d6ac40e279e9e2d746cf0 to your computer and use it in GitHub Desktop.
Common helper functions and objects
export const COND = {
//*TRUE if "needlessly difficult to code for" apple product™
check_ios: () => {
return (
['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(
navigator.platform
) ||
// iPad on iOS 13 detection
(navigator.userAgent.includes('Mac') && 'ontouchend' in document)
);
},
// *TRUE if android phone
check_droid: /(android)/i.test(navigator.userAgent)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment