All files / api/common/util throw-if-null.ts

100% Statements 5/5
100% Branches 1/1
100% Functions 1/1
100% Lines 3/3

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            2x       7x 6x    
/**
 *
 * @param data nullable한 데이터로서 data가 null인지 확인한다.
 * @param exception data가 null일 때, throw되는 객체
 * @returns null이 아닌 data를 반환한다.
 */
export const throw_if_null = <T>(
  data: T | null | undefined,
  exception: any,
): T => {
  if (data == null) throw exception;
  return data;
};