← All procedures

quantity.canonicalUnit

This function gives the canonical spelling of a unit, for data from another system: "hr" is "h".

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

From the command line

$ mark quantity canonicalUnit --spelling <string>

As data, in a program

{
  "$proc": ["quantity", "canonicalUnit"],
  "input": { "spelling": "<spelling>" }
}

Input

FieldTypeRequiredDefaultDescription
spellingstringyes

Output

The schema does not list fields (string).

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