mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
15 lines
397 B
TypeScript
15 lines
397 B
TypeScript
![]() |
/**
|
||
|
* Runtime validation utilities for FileId safety
|
||
|
*/
|
||
|
|
||
|
import { FileId } from '../types/fileContext';
|
||
|
|
||
|
// Validate that a string is a proper FileId (has UUID format)
|
||
|
export function isValidFileId(id: string): id is FileId {
|
||
|
// Check UUID v4 format: 8-4-4-4-12 hex digits
|
||
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||
|
return uuidRegex.test(id);
|
||
|
}
|
||
|
|
||
|
|