Files: f7fae0895ef6595ffae8b99aa9fbb72bde7ecaa2 / utils / mobile.js
370 bytesRaw
1 | import { getUserAgent } from '../utils/request'; |
2 | |
3 | /** |
4 | * @function isMobile |
5 | * @description Returns if the current device is mobile |
6 | * @param {Object} request Http request |
7 | * @return {Boolean} Is mobile or not |
8 | */ |
9 | export const isMobile = (request) => { |
10 | const userAgent = getUserAgent(request); |
11 | |
12 | if (/Mobi/.test(userAgent)) { |
13 | return true; |
14 | } |
15 | |
16 | return false; |
17 | }; |
Built with git-ssb-web