client.filter
Filter array by property value or predicate
browsernot registered- Package
- @procedures/client · README
- Path
["client","filter"]- CLI
- Not a
markcommand: it is not in the default registry. - As data
{"$proc":["client","filter"],"input":{}}- Tags
- core, array, filter
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";
for (const procedure of allCoreProcedures) {
if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","filter"], { items: [] });
console.log(JSON.stringify(result));As data, in a program
{ "$proc": ["client", "filter"], "input": { "items": [] } }Input
| Field | Type | Required |
|---|---|---|
items | unknown[] | yes |
key | string | no |
value | unknown | no |
values | unknown[] | no |
match | "equals" | "not" | "in" | "notIn" | "contains" | "startsWith" | "endsWith" | "gt" | "gte" | "lt" | "lte" | no |
invert | boolean | no |
Output
The schema does not list fields (any[]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {},
"description": "Array to filter"
},
"key": {
"description": "Property to match against",
"type": "string"
},
"value": {
"description": "Value to match (equality check)"
},
"values": {
"description": "Values to match (any of these)",
"type": "array",
"items": {}
},
"match": {
"description": "Match mode: 'equals', 'not', 'in', 'notIn', 'contains', 'startsWith', 'endsWith'",
"type": "string",
"enum": [
"equals",
"not",
"in",
"notIn",
"contains",
"startsWith",
"endsWith",
"gt",
"gte",
"lt",
"lte"
]
},
"invert": {
"description": "Invert the filter",
"type": "boolean"
}
},
"required": [
"items"
]
},
"output": {
"type": "array",
"items": {},
"description": "The items that pass the condition"
}
}