getFileName

View sourcegetFileName(url: string): string

Returns the text before the first dot in the final slash-delimited segment.

This is a lightweight string helper, not a URL or filesystem parser. It treats only / as a separator, keeps query strings intact, and returns an empty string for an empty input, a trailing slash, or a final segment that starts with a dot.

Examples

getFileName('/assets/hero.sprite.png') // 'hero'
getFileName('README') // 'README'

Parameters

NameDescriptionDefault
url

Path-like string to inspect.

—

Returns

The first dot-delimited part of the final path segment.