← All procedures

client.slice

Extract portion of array

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

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

As data, in a program

{ "$proc": ["client", "slice"], "input": { "items": [], "start": 1 } }

Input

FieldTypeRequired
itemsunknown[]yes
startnumberyes
endnumberno

Output

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

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {},
        "description": "The array"
      },
      "start": {
        "type": "number",
        "description": "The start position (inclusive)"
      },
      "end": {
        "description": "The end position (exclusive)",
        "type": "number"
      }
    },
    "required": [
      "items",
      "start"
    ]
  },
  "output": {
    "type": "array",
    "items": {},
    "description": "The items of the range"
  }
}