📄 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: booleaninfos: 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: numbermin: numbermax: number- Return Type:
number - Calls:
Math.min
noop(): void¶
- Return Type:
void
rand(min: number, max: number): number¶
Code
- Parameters:
min: numbermax: number- Return Type:
number - Calls:
Math.ceilMath.floorMath.random
hasOwn(val: T, key: K): key is K¶
Code
- Parameters:
val: Tkey: 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: