Skip to content

Tankōbon / shared/file-name-template / parseFileName

Function: parseFileName() ​

parseFileName(name, template): Partial<Record<"title" | "author" | "series" | "volume" | "year", string>> | null

Defined in: shared/file-name-template.ts:60

Reads a file name (without its extension) with a template written like libraryFileName, the reverse of fillFileNameTemplate: with {series} - T{volume}, Tintin - T20 gives { series: 'Tintin', volume: '20' }. The whole name has to match; null when it doesn't, or when the template has no field. _ counts as a space on both sides, the empty template matches nothing.

Parameters ​

name ​

string

template ​

string

Returns ​

Partial<Record<"title" | "author" | "series" | "volume" | "year", string>> | null