Skip to main content

trimExt()

const trimExt: (filename, ignoreExts?, maxSize?) => string = upath.trimExt

Trims a filename's extension.

Extensions are considered to be up to maxSize chars long, counting the dot (defaults to 7).

An Array of ignoreExts (eg ['.min']) prevents these from being considered as extension, thus are not trimmed.

Parameters

ParameterTypeDescription

filename

string

string filename to trim it's extension

ignoreExts?

string[]

array extensions to ignore

maxSize?

number

number max length of the extension

Returns

string