Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

498 B
Raw Blame
import type { PdfRawImage } from './pdf.types';
import { IMAGE_KIND_CHANNELS } from './pdf.constants';

export function isValidPdfImage(image: unknown): image is PdfRawImage {
  return (
    image != null &&
    typeof image === 'object' &&
    'data' in image &&
    'width' in image &&
    typeof image.width === 'number' &&
    'height' in image &&
    typeof image.height === 'number' &&
    'kind' in image &&
    typeof image.kind === 'number' &&
    image.kind in IMAGE_KIND_CHANNELS
  );
}