Add a utility to convert file URL or path to one of them?
未关闭
还没有人认领这个 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 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