All files / lib command-options.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

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 151x           1x 4x 4x     1x 179x    
const symbol = Symbol('Command Options');
 
export type CommandOptions<T> = T & {
    readonly [symbol]: true
};
 
export function commandOptions<T>(options: T): CommandOptions<T> {
    (options as any)[symbol] = true;
    return options as CommandOptions<T>;
}
 
export function isCommandOptions<T>(options: any): options is CommandOptions<T> {
    return options && options[symbol] === true;
}