@lifaon/path
Version:
Useful tool to manage paths like the URL object
8 lines • 371 B
JavaScript
/**
* Returns the basename of a segment, without 'ext' if provided
* INFO: 'basename' must be a valid entry name (must not be root or relative)
*/
export function getBasenameOfEntryPathSegment(segment, ext = '') {
return ext !== '' && segment.endsWith(ext) ? segment.slice(0, -ext.length) : segment;
}
//# sourceMappingURL=get-basename-of-entry-path-segment.js.map