All files / src/shared/FilePreview utils.ts

30% Statements 3/10
0% Branches 0/7
50% Functions 1/2
30% Lines 3/10

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 22 23 24 25      88x 709x                 88x                      
import { FilePreviewType } from "./types";
import { TDocument } from "@common/FilePreview/types";
 
export const fileFormatter = (file: FilePreviewType): TDocument => {
  return {
    id: file.id,
    name: file.fileName,
    URL: file.fileURL,
    type: file.fileType,
    tag: file.tag,
  };
};
 
export const getThreshold = (scale = 1) => {
  if (scale > 1.4) {
    return 0.2;
  } else if (scale > 1) {
    return 0.4;
  } else if (scale < 0.8) {
    return 0.95;
  } else {
    return 0.8;
  }
};