按条件移除
使用 lodash _.remove 按条件移除数组元素
当元素满足选择的谓词时将其从数组中移除。
**亮点:**
- 使用 lodash `_.remove`
- 支持数字和字符串比较
- 返回剩余数组的 JSON
**示例:**
- 数组:`[1, 2, 3, 4]`
- 谓词:`greater-than`
- 比较值:`2`
- 结果:`[1, 2]`
API 文档
请求端点
POST /zh/api/tools/remove-by-predicate
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| array | textarea | 是 | 输入 JSON 数组 |
| predicateType | select | 是 | 选择移除条件 |
| compareValue | text | 否 | 比较值(大多数谓词需要) |
响应格式
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}
文本:
文本
AI MCP 文档
将此工具添加到您的 MCP 服务器配置中:
{
"mcpServers": {
"elysiatools-remove-by-predicate": {
"name": "remove-by-predicate",
"description": "使用 lodash _.remove 按条件移除数组元素",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=remove-by-predicate",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
你可以串联多个工具,比如:`https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`,最多20个。
如果遇见问题,请联系我们:[email protected]