mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-08 04:10:35 -07:00
20 lines
452 B
TypeScript
20 lines
452 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2026 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import * as path from 'node:path';
|
|
|
|
/**
|
|
* Gets the file extension from a filename or path, excluding the leading dot.
|
|
* Returns null if no extension is found.
|
|
*/
|
|
export function getFileExtension(
|
|
filename: string | null | undefined,
|
|
): string | null {
|
|
if (!filename) return null;
|
|
const ext = path.extname(filename);
|
|
return ext ? ext.slice(1) : null;
|
|
}
|