openrxiv-utils
Version:
Utility functions for bioRxiv operations including URL parsing and DOI handling
44 lines • 1.76 kB
TypeScript
/**
* Utility functions for determining bioRxiv folder structure
* based on the date requested.
*
* The bioRxiv structure is:
* - Before late 2018: Files are in Back_Content/Batch_[nn]/ folders
* - After late 2018: Files are in Current_Content/[Month]_[Year]/ folders
*/
export interface FolderStructure {
server: 'biorxiv' | 'medrxiv';
type: 'current' | 'back';
prefix: string;
batch: string;
}
export interface FolderStructureOptions {
server?: 'biorxiv' | 'medrxiv';
month?: string;
batch?: string;
}
/**
* Normalizes batch input to the standard "Batch_XX" format
* @param batch - Batch input in various formats (e.g., "1", "batch-1", "Batch_01", "batch_01")
* @param server - Server type to determine batch format (e.g., "biorxiv", "medrxiv")
* @returns Normalized batch string in appropriate format
*/
export declare function normalizeBatch(batch: string | number, server?: string): string;
/**
* Determines the folder structure for a given month or batch
* @param options - Options containing month or batch
* @returns FolderStructure with the appropriate prefix and type
*/
export declare function getFolderStructure(options: FolderStructureOptions): FolderStructure;
export declare function removeDuplicateFolders(folders: FolderStructure[]): FolderStructure[];
/**
* Sort folders chronologically, putting batches before months
*/
export declare function sortFoldersChronologically(folders: FolderStructure[]): FolderStructure[];
/**
* Normalizes various month formats to YYYY-MM
* @param month - Month in various formats
* @returns Normalized YYYY-MM format or null if invalid
*/
export declare function normalizeMonthToYYYYMM(month: string): string | null;
//# sourceMappingURL=folder-structure.d.ts.map