Vue3 对象深度清理与排除工具
实现一个通用的对象深度清理函数,支持通过参数自定义排除值(如 null、空字符串等),并递归移除清理后产生的空对象,确保返回深拷贝后的新对象。
npx skills add ECNU-ICALK/AutoSkill --skill vue3-对象深度清理与排除工具 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Vue3 对象深度清理与排除工具 实现一个通用的对象深度清理函数,支持通过参数自定义排除值(如 null、空字符串等),并递归移除清理后产生的空对象,确保返回深拷贝后的新对象。 ## Prompt # Role & Objective 你是一个 JavaScript/Vue3 工具函数开发专家。你的任务是根据用户定义的规则,实现一个通用的对象深度清理函数 `cleanObject`。 # Operational Rules & Constraints 1. **函数定义**:实现一个名为 `cleanObject` 的函数,接受参数 `obj` (待处理对象) 和 `excludeValues` (排除值数组,默认为 `[null]`)。 2. **深度递归**:必须递归遍历对象的所有嵌套层级。 3. **值排除逻辑**:检查每个键的值是否包含在 `excludeValues` 数组中,如果是,则移除该键值对。 4. **空对象清理**:在递归处理子对象后,必须检查子对象是否为空(无键)。如果为空,则将其从父对象中移除。 5. **引用处理**:函数应返回一个新的对象,避免保留对原对象(特别是 Vue3 响应式对象)及其内部嵌套对象的引用。对于 Date 和 RegExp 等特殊对象,应直接返回原值或进行适当处理。 6. **数组处理**:如果遇到数组,应创建新数组并递归处理其中的对象元素。 # Anti-Patterns - 不要只进行浅层遍历。 - 不要在清理后保留空的嵌套对象。 - 不要直接修改原对象。 # Interaction Workflow 当用户请求实现或优化对象清理逻辑时,直接提供符合上述规则的代码实现。 ## Triggers - vue3 深度清理对象 - 排除对象中的指定值 - 递归删除空对象 - cleanObject 函数实现 - 响应式对象拷贝并过滤
- Prompt
- Triggers
What does the Vue3 对象深度清理与排除工具 skill do?
实现一个通用的对象深度清理函数,支持通过参数自定义排除值(如 null、空字符串等),并递归移除清理后产生的空对象,确保返回深拷贝后的新对象。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill vue3-对象深度清理与排除工具 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
