sindresorhus / normalize-url

Normalize a URL
MIT License
837 stars 123 forks source link

(suggestion) Remove sub directories #188

Open MortezaHeydari97 opened 3 months ago

MortezaHeydari97 commented 3 months ago

Hi, Sometimes we need the pure domain only. So I've a new suggestion to implement a new option to remove sub directories of the URL.

sindresorhus commented 3 months ago

Yeah, there could be a removePath option that defaults to false.

MortezaHeydari97 commented 3 months ago

Yes, I'm agree. Ok then, I will send the PR

millette commented 2 months ago

Related to #190 but I only wanted to remove certain sub directories.

sindresorhus commented 2 months ago

I think we could let it also accept a function that is provided the path components and is expected to return the new path components.