← All procedures
quantity.round
This function rounds an amount to the decimals that its unit keeps (money to the cent), or to `decimals`.
CLI- Package
- @procedures/quantity · README
- Path
["quantity","round"]- CLI
mark quantity round --amount <object>- As data
{"$proc":["quantity","round"],"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","round"], { amount: {} });
console.log(JSON.stringify(result));From the command line
$ mark quantity round --amount <object>
As data, in a program
{ "$proc": ["quantity", "round"], "input": { "amount": {} } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"amount": {
"type": "object",
"properties": {
"value": {
"type": "number"
},
"unit": {
"type": "string"
}
},
"required": [
"value",
"unit"
],
"additionalProperties": {}
},
"decimals": {
"type": "number"
}
},
"required": [
"amount"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"value": {
"type": "number"
},
"unit": {
"type": "string"
}
},
"required": [
"value",
"unit"
],
"additionalProperties": {}
}
}