← All procedures

client.pluck

Extract single property from all items

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

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

As data, in a program

{
  "$proc": ["client", "pluck"],
  "input": { "items": [], "key": "<key>" }
}

Input

FieldTypeRequired
itemsunknown[]yes
keystringyes

Output

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

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {},
        "description": "Array of objects"
      },
      "key": {
        "type": "string",
        "description": "Property to extract"
      }
    },
    "required": [
      "items",
      "key"
    ]
  },
  "output": {
    "type": "array",
    "items": {},
    "description": "The value of the field of each item"
  }
}