Functional Weave
Code in Python

Results for “units”

100 capabilities

form.money-input
Read a typed amount as minor units for its currency and locale, check min/max, and format it back.
A group of 3: parse_money_input, format_money_input, money_input_format
money.parse
Parse "£1,234.50" or "1.234,50 €" into integer minor units, strictly: no guessing, no rounding.
parse_money in Python
energy.gas-kwh
Convert gas meter units (cubic metres or hundreds of cubic feet) to kWh with the calorific value and 1.02264 correction.
gas_kwh in Python
react.form.money-field React ^19 · TypeScript only
A money input with its currency symbol, locale separators and min/max, read and checked by form.money-input.
Not available in Python
logistics.sscc
Build an 18-digit SSCC pallet label number from extension digit, GS1 company prefix and serial, with its check digit.
build_sscc in Python
math.basis-points
Convert a rate between percent, basis points and a plain ratio exactly, as decimal text or integer basis points.
A group of 3: convert_rate, to_basis_points, from_basis_points
fleet.emissions
Vehicle greenhouse gas emissions (grams CO2e) from fuel used or distance, using UK government DESNZ conversion factors.
fleet_emissions in Python
form.file-check
Check files chosen in an upload field: accept types, size, empty files and how many, with GOV.UK messages.
A group of 3: validate_files, accepts_file, format_file_size
math.exp
e to the power x from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
exp in Python
math.ln
Natural logarithm from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
ln in Python
math.atan
Arctangent in radians from + - * / only (fdlibm's method), so every language returns the same double.
atan in Python
charts.format
Axis and label text for charts: tick numbers, SI prefixes (1.2k, 3.4M), percentages, dates and money.
A group of 5: format_tick, format_si, format_percent, format_date, format_money_tick
fleet.fuel-cost
Fuel cost of a trip from distance, fuel economy (UK or US mpg, or L/100km) and price per litre, exactly.
fuel_cost in Python
text.number-to-words
Write a money amount in words for a cheque: "one thousand two hundred and thirty-four pounds and fifty-six pence".
amount_in_words in Python
health.egfr Unreviewed
eGFR in mL/min/1.73 m² by the race-free CKD-EPI 2021 creatinine equation, from creatinine in µmol/L or mg/dL.
egfr_ckd_epi2021 in Python
retail.basket-total
Total a basket: line prices, promotions, a basket discount, VAT per line and delivery, into one checked total.
basket_total in Python
math.rational
Exact fraction arithmetic, always reduced, for rates and ratios that must not drift.
A group of 8: calculate_rational, rational, add_rational, subtract_rational, multiply_rational, divide_rational, compare_rational, rational_to_integer