nodejs / nodejs/node

Add a utility to convert file URL or path to one of them?

未关闭
#41,521 41 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature request never-stale url
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

What is the problem this feature will solve?

It's a nice way to accept both URL and path string in API, but we need covert it to either string or URL, it would be nice to have a built-in method to do this.

What is the feature you are proposing to solve the problem?

For converting to string:

Maybe add path.from(URL | string)? @sindresorhus proposed here.

For converting to URL:

url.from(URL | string)

I'm not sure, since URL is a standard, I guess adding method URL object won't be acceptable, maybe to node:url module?

What alternatives have you considered?

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先审查提议的 path.from(URL | string) 和 url.from(URL | string) API,以及 issue 中提到的 node:url 模块。确定哪种转换语义和模块归属是合适的;当一种 API 形态及其行为得到明确规范并完成实现,同时具备相应的测试覆盖时,工作即告完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
api, backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。