mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add isLinux helper
This commit is contained in:
parent
4f036bb267
commit
350f9d5b19
1 changed files with 28 additions and 2 deletions
|
|
@ -5,11 +5,37 @@ export function isNuxt( VueThis ) {
|
||||||
return has( VueThis, [ '$nuxt' ])
|
return has( VueThis, [ '$nuxt' ])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isBrowserContext () {
|
||||||
|
if ( typeof navigator === 'undefined' ) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasProcesGlobal () {
|
||||||
|
if ( typeof process === 'undefined' ) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// https://stackoverflow.com/a/8684009/1397641
|
// https://stackoverflow.com/a/8684009/1397641
|
||||||
export function isDarwin () {
|
export function isDarwin () {
|
||||||
if ( typeof navigator !== 'undefined' ) return false
|
if ( isBrowserContext() ) return false
|
||||||
|
|
||||||
if ( typeof process === 'undefined' ) return false
|
if ( !hasProcesGlobal() ) return false
|
||||||
|
|
||||||
return process.platform === 'darwin'
|
return process.platform === 'darwin'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function isLinux () {
|
||||||
|
if ( isBrowserContext() ) return false
|
||||||
|
|
||||||
|
if ( !hasProcesGlobal() ) return false
|
||||||
|
|
||||||
|
if ( process.platform === 'linux' ) return true
|
||||||
|
|
||||||
|
if ( process.platform === 'openbsd' ) return true
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue