quantity.lookupAtom
This function gives the atom that a spelling names: its symbol or one of its aliases.
CLI- Package
- @procedures/quantity · README
- Path
["quantity","lookupAtom"]- CLI
mark quantity lookupAtom --spelling <string>- As data
{"$proc":["quantity","lookupAtom"],"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","lookupAtom"], { spelling: "<spelling>" });
console.log(JSON.stringify(result));From the command line
$ mark quantity lookupAtom --spelling <string>
As data, in a program
{
"$proc": ["quantity", "lookupAtom"],
"input": { "spelling": "<spelling>" }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
spelling | string | yes |
Output
The schema does not list fields (object | null).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"spelling": {
"type": "string"
}
},
"required": [
"spelling"
],
"additionalProperties": false
},
"output": {
"anyOf": [
{
"type": "object",
"properties": {
"symbol": {
"type": "string"
},
"name": {
"type": "string"
},
"display": {
"type": "string",
"description": "This text is how it prints, where that is not its symbol: °F, µs."
},
"vector": {
"type": "object",
"properties": {
"time": {
"type": "number"
},
"length": {
"type": "number"
},
"mass": {
"type": "number"
},
"temperature": {
"type": "number"
},
"data": {
"type": "number"
},
"money": {
"type": "number"
},
"current": {
"type": "number"
}
},
"additionalProperties": {}
},
"factor": {
"type": "object",
"properties": {
"n": {
"type": "string",
"pattern": "^-?(0|[1-9][0-9]*)$",
"x-procedures-codec": "bigint"
},
"d": {
"type": "string",
"pattern": "^-?(0|[1-9][0-9]*)$",
"x-procedures-codec": "bigint"
}
},
"required": [
"n",
"d"
],
"additionalProperties": {}
},
"offset": {
"type": "object",
"properties": {
"n": {
"type": "string",
"pattern": "^-?(0|[1-9][0-9]*)$",
"x-procedures-codec": "bigint"
},
"d": {
"type": "string",
"pattern": "^-?(0|[1-9][0-9]*)$",
"x-procedures-codec": "bigint"
}
},
"required": [
"n",
"d"
],
"additionalProperties": {},
"description": "An affine unit (a temperature) has an offset: base = (value + offset) × factor."
},
"log": {
"type": "boolean",
"const": true,
"description": "A logarithmic level converts only to itself, and it averages by energy."
},
"counts": {
"type": "string",
"description": "This name is what it counts, when it is a count of something: a GT is 10⁹ transfers, a bpm counts beats."
},
"percent": {
"type": "boolean",
"const": true,
"description": "A percentage makes a unit with no dimension a ratio."
},
"param": {
"type": "string",
"const": "hz",
"description": "Its size changes with the system that it measures: a jiffy is 1/HZ seconds."
},
"decimals": {
"type": "number",
"description": "An amount keeps this many decimal places: money keeps the cent."
},
"aliases": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"symbol",
"name",
"vector",
"factor"
],
"additionalProperties": {}
},
{
"type": "null"
}
]
}
}