truemedian / luvit-api-design

11 stars 2 forks source link

`path.basename` extension argument #14

Closed RiskoZoSlovenska closed 2 years ago

RiskoZoSlovenska commented 2 years ago

As was mentioned in https://github.com/truemedian/luvit-api-design/pull/9#issuecomment-1050858085, path.basename is missing 2.x's expected_ext argument. However, perhaps we would like to consider "an exclude_extension boolean instead of an expected_ext string param".

Arguments for:

Arguments against:

Discuss below.

RiskoZoSlovenska commented 2 years ago

Here's a potential third option: If the argument is a string, treat it as the extension to remove (2.x behaviour). Otherwise, if it's true, remove any extension (proposed behaviour).

truemedian commented 2 years ago

I rather like that third option, since it provides the greatest amount of flexibility, and is not all that difficult to implement or understand.