UNPKG

@flex-development/pathe

Version:

Universal drop-in replacement for node:path

35 lines (34 loc) 745 B
/** * @file formatExt * @module pathe/lib/formatExt */ import type { EmptyString, Ext } from '@flex-development/pathe'; /** * Format a file extension. * * @see {@linkcode EmptyString} * @see {@linkcode Ext} * * @example * formatExt('') // '' * @example * formatExt(null) // '' * @example * formatExt('.ts ') // '.ts' * @example * formatExt(' mjs') // '.mjs' * @example * formatExt('d.mts') // '.d.mts' * * @category * utils * * @this {void} * * @param {string | null | undefined} ext * The file extension to format * @return {EmptyString | Ext} * Formatted file extension or empty string */ declare function formatExt(this: void, ext: string | null | undefined): EmptyString | Ext; export default formatExt;