Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.08 KB

extname.md

File metadata and controls

39 lines (28 loc) · 1.08 KB

extname (function)

Returns the file extension of the file at a given path.

If the file has no extension (eg Makefile, etc), then '' will be returned.

  • @param pathOrFilename — The input path
  • @param options — Options which affect the return value. See ExtnameOptions.
declare function extname(
  pathOrFilename: string | Path,
  options?: ExtnameOptions
): string;

ExtnameOptions (interface)

Options for extname and Path.prototype.extname.

declare interface ExtnameOptions {
  full?: boolean;
}

ExtnameOptions.full (boolean property)

Whether to get compound extensions, like .d.ts or .test.js, instead of just the final extension (.ts or .js in this example).

full?: boolean;