gpt4 book ai didi

javascript - 从 JSON 构建 URLS

转载 作者:行者123 更新时间:2023-11-30 06:37:41 24 4
gpt4 key购买 nike

我已经创建了一个可以像这样构建嵌套 url 的函数。我想知道是否存在更主流的库来构建这样的 url/uris。我宁愿使用标准。

utility.urlConstruct({
"scheme": "https://",
"domain": "domain.com",
"path": "/login",
"query":{
"user":"thomasreggi",
"from":utility.urlConstruct({
"scheme": "https://",
"domain": "redirect.com",
"path": "/funstuff",
}),
}
});

吐出来

https://domain.com/login?user=thomasreggi&from=https%3A%2F%2Fredirect.com%2Ffunstuff

最佳答案

正确答案是节点的内置 URL library .

特别是

url.format(urlObj)

关于javascript - 从 JSON 构建 URLS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13498417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com