Files: 83be8b8f43a8989f425e4948524233cb63983146 / 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