← All procedures

client.where

Filter array where all key-value pairs match

browsernot registered
Package
@procedures/client · README
Path
["client","where"]
CLI
Not a mark command: it is not in the default registry.
As data
{"$proc":["client","where"],"input":{}}
Tags
core, array, filter

Try it in the Composer →

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","where"], { items: [], where: {} });
console.log(JSON.stringify(result));

As data, in a program

{ "$proc": ["client", "where"], "input": { "items": [], "where": {} } }

Input

FieldTypeRequired
itemsunknown[]yes
whereRecord<string, unknown>yes

Output

The schema does not list fields (any[]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {},
        "description": "Array to filter"
      },
      "where": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {},
        "description": "Object with key-value pairs to match"
      }
    },
    "required": [
      "items",
      "where"
    ]
  },
  "output": {
    "type": "array",
    "items": {},
    "description": "The items whose fields match"
  }
}