← All procedures

client.trim

Trim whitespace from string

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

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

As data, in a program

{ "$proc": ["client", "trim"], "input": { "value": "<value>" } }

Input

FieldTypeRequired
valuestringyes
side"start" | "end" | "both"no

Output

The schema does not list fields (string).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "value": {
        "type": "string",
        "description": "The value"
      },
      "side": {
        "description": "Which side to trim: start, end or both (default: both)",
        "type": "string",
        "enum": [
          "start",
          "end",
          "both"
        ]
      }
    },
    "required": [
      "value"
    ]
  },
  "output": {
    "type": "string",
    "description": "The string without the outer white space"
  }
}