All files / utils/src/guards index.ts

100% Statements 8/8
100% Branches 7/7
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 162x 13x     2x 9x     2x 20x     2x 9x    
export const isNumber = (value: unknown): value is number => {
  return typeof value === 'number' && !Number.isNaN(value);
};
 
export const isString = (value: unknown): value is string => {
  return typeof value === 'string';
};
 
export const isDefined = <T>(value: T | undefined | null): value is T => {
  return value !== undefined && value !== null;
};
 
export const isObject = (value: unknown): value is Record<string, unknown> => {
  return typeof value === 'object' && value !== null && !Array.isArray(value);
};