← All procedures

quantity.scale

This function multiplies an amount by a plain number: a count of probes, or a share.

CLI
Package
@procedures/quantity · README
Path
["quantity","scale"]
CLI
mark quantity scale --amount <object> --by <number>
As data
{"$proc":["quantity","scale"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/quantity/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["quantity","scale"], { amount: {}, by: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark quantity scale --amount <object> --by <number>

As data, in a program

{ "$proc": ["quantity", "scale"], "input": { "amount": {}, "by": 1 } }

Input

FieldTypeRequiredDefaultDescription
amountobjectyes
bynumberyes

Output

FieldTypeRequiredDefaultDescription
valuenumberyes
unitstringyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "amount": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number"
          },
          "unit": {
            "type": "string"
          }
        },
        "required": [
          "value",
          "unit"
        ],
        "additionalProperties": {}
      },
      "by": {
        "type": "number"
      }
    },
    "required": [
      "amount",
      "by"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "value": {
        "type": "number"
      },
      "unit": {
        "type": "string"
      }
    },
    "required": [
      "value",
      "unit"
    ],
    "additionalProperties": {}
  }
}