MCPcopy Create free account
hub / github.com/5e-bits/5e-database / getCollectionPrefix

Function getCollectionPrefix

scripts/dbUtils.ts:76–80  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

74 * @returns The prefix string (e.g., '2014-') or an empty string.
75 */
76export function getCollectionPrefix(filepath: string): string {
77 const parts = filepath.split('/');
78 const yearIdx = parts.findIndex((p) => YEAR_DIR_PATTERN.test(p));
79 return yearIdx >= 0 ? parts[yearIdx] + '-' : '';
80}
81
82/**
83 * Extracts the BCP 47 locale code from a locale-nested filepath.

Callers 5

updateIndexCollectionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected