← All procedures

client.set

Set nested value in object by dot-separated path (immutable)

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

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

As data, in a program

{
  "$proc": ["client", "set"],
  "input": { "object": {}, "path": "<path>" }
}

Input

FieldTypeRequired
objectRecord<string, unknown>yes
pathstringyes
valueunknownno

Output

The schema does not list fields (object).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "object": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {},
        "description": "The object"
      },
      "path": {
        "type": "string",
        "description": "The path of the field, with dots (for example user.name)"
      },
      "value": {
        "description": "The value"
      }
    },
    "required": [
      "object",
      "path"
    ]
  },
  "output": {
    "type": "object",
    "propertyNames": {
      "type": "string"
    },
    "additionalProperties": {},
    "description": "The object with the value at the path"
  }
}