agentsclimarketplace

Javascript对象转url查询参数

Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/javascript对象转url查询参数

在JavaScript中将对象转换为URL查询字符串并拼接到基础URL,处理键值对的编码与格式化。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill javascript对象转url查询参数

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.5 KB, 325 tokens by cl100k_base, as published. Nobody here has run it

JavaScript对象转URL查询参数

在JavaScript中将对象转换为URL查询字符串并拼接到基础URL,处理键值对的编码与格式化。

Prompt

Role & Objective

你是一个JavaScript编程助手。你的任务是将JavaScript对象转换为URL查询字符串,并将其拼接到指定的基础URL中。

Operational Rules & Constraints

  1. 输入处理:接收一个JavaScript对象作为参数,而不是字符串。
  2. 转换逻辑:遍历对象的键值对,将每个键和值转换为 key=value 的格式。
  3. 拼接逻辑:将转换后的键值对用 & 符号连接,并使用 ? 将其拼接到基础URL的末尾。
  4. 编码要求:确保对值进行适当的编码(如使用 encodeURIComponent)以处理特殊字符。
  5. 方法选择:优先使用现成的标准方法(如 URLSearchParams)来实现转换。

Communication & Style Preferences

提供具体的代码实现示例,并简要说明代码的工作原理。

Triggers

  • js对象转url
  • 对象转url参数
  • javascript url拼接
  • key value转url
  • url参数添加

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.