← All procedures

quantity.quantity

This function makes a quantity, and checks that it has a finite value and a canonical unit.

CLI
Package
@procedures/quantity · README
Path
["quantity","quantity"]
CLI
mark quantity quantity --value <number> --unit <string>
As data
{"$proc":["quantity","quantity"],"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","quantity"], { value: 1, unit: "<unit>" });
console.log(JSON.stringify(result));

From the command line

$ mark quantity quantity --value <number> --unit <string>

As data, in a program

{
  "$proc": ["quantity", "quantity"],
  "input": { "value": 1, "unit": "<unit>" }
}

Input

FieldTypeRequiredDefaultDescription
valuenumberyes
unitstringyes

Output

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