← All procedures

quantity.formatUnit

This function gives how a unit reads next to an amount: "kcal/(h·kg)", "sets/wk", "% of 1RM", "mph".

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

From the command line

$ mark quantity formatUnit --unit <string>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
unitstringyes
manybooleanno

Output

The schema does not list fields (string).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "unit": {
        "type": "string"
      },
      "many": {
        "type": "boolean"
      }
    },
    "required": [
      "unit"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "string"
  }
}