Skip to content

extname

Import from @varavel/vdl-plugin-sdk/utils/paths.

function extname(path): string;

Returns the file extension of a path, including the leading dot.

Parameters

Parameter Type Description
path string Path to inspect.

Returns

string

The extension portion of path, or an empty string when none exists.

Example

extname("generated/models/user.ts");
// returns ".ts"

See

Powered by pathe (MIT License): https://github.com/unjs/pathe