All files / rusted-chromium/utils typeguards.ts

100% Statements 8/8
100% Branches 8/8
100% Functions 4/4
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21    42x 39x     42x 988x           42x 281x     42x 25x    
import type { IChromeConfig, IChromeSingleConfig, IVersionWithDisabled, IVersion, TextFunction } from '../interfaces/interfaces'
 
export function isTextFunction(value: string | TextFunction | undefined): value is TextFunction {
    return typeof value === 'function'
}
 
export function isIVersion(value: unknown): value is IVersion {
    return typeof (value as IVersion).major === 'number'
        && typeof (value as IVersion).minor === 'number'
        && typeof (value as IVersion).branch === 'number'
        && typeof (value as IVersion).patch === 'number'
}
 
export function isIVersionWithDisabled(value: unknown): value is IVersionWithDisabled {
    return isIVersion(value) && typeof (value as IVersionWithDisabled).disabled === 'boolean'
}
 
export function isChromeSingleConfig(value: Partial<IChromeConfig>): value is Partial<IChromeSingleConfig> {
    return value.single !== null && value.single !== undefined
}