Files
kandev/apps/web/lib/utils/file-path.ts
T
Carlos Florêncio f4d1dfd3a7 feat: better context files (#222)
feat: context files
2026-02-14 20:13:11 +00:00

12 lines
405 B
TypeScript

/** Check if a path looks like a directory (ends with / or has no extension). */
export function isDirectory(filePath: string): boolean {
if (filePath.endsWith('/')) return true;
const name = filePath.split('/').pop() || '';
return !name.includes('.');
}
/** Extract filename from a path. */
export function getFileName(filePath: string): string {
return filePath.split('/').pop() || filePath;
}