📄 is.ts
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 11 |
📊 Variables & Constants | 3 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/shared/utils/is.ts
Variables & Constants¶
Name | Type | Kind | Value | Exported |
---|---|---|---|---|
isClient |
boolean |
const | typeof window !== 'undefined' && typeof document !== 'undefined' |
✓ |
isWorker |
boolean |
const | typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope |
✓ |
toString |
() => string |
const | Object.prototype.toString |
✗ |
Functions¶
isDef(val: T): val is T
¶
- Parameters:
val: T
- Return Type:
val is T
notNullish(val: T | null | undefined): val is T
¶
- Parameters:
val: T | null | undefined
- Return Type:
val is T
assert(condition: boolean, infos: any[]): void
¶
- Parameters:
condition: boolean
infos: any[]
- Return Type:
void
- Calls:
console.warn
isObject(val: any): val is object
¶
- Parameters:
val: any
- Return Type:
val is object
now(): number
¶
- Return Type:
number
- Calls:
Date.now
timestamp(): number
¶
- Return Type:
number
clamp(n: number, min: number, max: number): number
¶
- Parameters:
n: number
min: number
max: number
- Return Type:
number
- Calls:
Math.min
noop(): void
¶
- Return Type:
void
rand(min: number, max: number): number
¶
Code
- Parameters:
min: number
max: number
- Return Type:
number
- Calls:
Math.ceil
Math.floor
Math.random
hasOwn(val: T, key: K): key is K
¶
Code
- Parameters:
val: T
key: K
- Return Type:
key is K
- Calls:
Object.prototype.hasOwnProperty.call
getIsIOS(): boolean
¶
Code
function getIsIOS() {
return isClient && window?.navigator?.userAgent && (
(/iP(?:ad|hone|od)/.test(window.navigator.userAgent))
// The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
// https://github.com/vueuse/vueuse/issues/3577
|| (window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent))
)
}
- Return Type:
boolean
- Calls:
/iP(?:ad|hone|od)/.test
/iPad|Macintosh/.test
- Internal Comments: