Skip to content

basename and extname added to URL.pathname - #47982

Closed
SetTrend wants to merge 1 commit into
nodejs:mainfrom
SetTrend:extend_url_with_path_properties
Closed

SetTrend wants to merge 1 commit into
nodejs:mainfrom
SetTrend:extend_url_with_path_properties

Conversation

@SetTrend

Copy link
Copy Markdown

Added two new getter properties to URL::pathname property:

  1. basename
  2. extname

Fixes: #47756

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/url

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation. labels May 12, 2023
Added two new getter properties to `URL::pathname` property:

1. `basename`
1. `extname`
@mscdex

mscdex commented May 12, 2023

Copy link
Copy Markdown
Contributor

These changes don't seem to be part of the standard?

@anonrig anonrig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is against the WHATWG URL standard. Pathname getter is defined in the spec: https://url.spec.whatwg.org/#dom-url-pathname

@SetTrend

SetTrend commented May 12, 2023 •

Copy link
Copy Markdown
Author

Yes, you are right.

My implementation is merely the result from a discussion in issue #47756. It's a work in progress; a draft; a suggestion; a quick shot; to be discussed.

From the NodeJS source code I expected that the project is using its own URL implementation. So, I extended the original implementation, not altering its main interface.

Which kind of changes would you like me to implement?

@tniessen

Copy link
Copy Markdown
Member

Anything we add to the node:url module that is not covered by the WhatWG URL Standard should be well-justified. I don't see that being the case here. The proposed additions cover niche cases that are better handled using existing APIs, as described in various comments in #47756.

@SetTrend SetTrend closed this May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. whatwg-url Issues and PRs related to the WHATWG URL implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add import.meta.directory and import.meta.file properties

5 participants