All files / Rindu/utils getIdFromUri.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 1/1
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 1527x       27x 10x 10x   17x 16x 16x   1x    
export function getIdFromUri(
  uri?: string,
  type?: "type" | "id"
): string | undefined {
  if (type === "id") {
    const id = uri?.split(":")[2];
    return id;
  }
  if (type === "type") {
    const type = uri?.split(":")[1];
    return type;
  }
  return "";
}