Function: basename()

basename(path, suffix?): string

Returns the last portion of a path, similar to the Unix basename command. Trims the query string if it exists. Optionally, removes a suffix from the result.

Parameters

path

string

The path to get the basename from.

suffix?

string

An optional suffix to remove from the basename.

Returns

string

The basename of the path.