← All procedures

client.merge

Merge multiple objects (shallow or deep)

browsernot registered
Package
@procedures/client · README
Path
["client","merge"]
CLI
Not a mark command: it is not in the default registry.
As data
{"$proc":["client","merge"],"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","merge"], { objects: [] });
console.log(JSON.stringify(result));

As data, in a program

{ "$proc": ["client", "merge"], "input": { "objects": [] } }

Input

FieldTypeRequired
objectsRecord<string, unknown>[]yes
deepbooleanno

Output

The schema does not list fields (object).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "objects": {
        "type": "array",
        "items": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        "description": "The objects"
      },
      "deep": {
        "description": "Merge nested objects too",
        "type": "boolean"
      }
    },
    "required": [
      "objects"
    ]
  },
  "output": {
    "type": "object",
    "propertyNames": {
      "type": "string"
    },
    "additionalProperties": {},
    "description": "The merged object"
  }
}