form.validate-input
Check a text, email or number input: required, length, pattern and min/max, with GOV.UK messages.
validate_input in Rust
1.0.0
py rs ts
49 tests
Apache-2.0
validation.email
Is this a plausible email address? A documented, pragmatic subset of RFC 5322, not the full grammar.
is_email in Rust
1.0.0
py rs ts
28 tests
Apache-2.0
text.pattern-match
Does the whole value match an HTML pattern attribute? The same answer in a browser, Python and Rust.
matches_pattern in Rust
1.0.0
py rs ts
47 tests
Apache-2.0
money.format
Render a monetary amount as text, using the currency's real minor-unit precision.
format_money in Rust
1.0.0
py rs ts
11 tests
Apache-2.0
auth.normalise-email
Trim an email address and lower-case its domain for storage and lookup, or null if it is not a plausible address.
normalise_email in Rust
1.0.0
py rs ts
12 tests
Apache-2.0
money.compare
Compare two amounts of one currency, refusing to compare across currencies; min, max and clamp too.
A group of 4: compare_money, min_money, max_money, clamp_money
2.0.0
py rs ts
39 tests
Apache-2.0
form.iso-date
Check a date picker value (YYYY-MM-DD) against required, past/future and min/max rules, timezone-safe.
validate_iso_date in Rust
1.0.0
py rs ts
24 tests
Apache-2.0
money.sum
Total a list of monetary amounts, with an explicit currency for the empty case.
sum_money in Rust
1.0.1
py rs ts
11 tests
Apache-2.0
money.add
Add, subtract and negate monetary amounts, refusing to mix currencies.
add_money in Rust
1.0.1
py rs ts
12 tests
Apache-2.0
money.apply-rate
Apply a rate expressed in basis points to a monetary amount, with an explicit rounding mode.
apply_rate in Rust
1.0.1
py rs ts
22 tests
Apache-2.0
form.date-parts
Check a date typed into day, month and year boxes, with GOV.UK's error messages and the boxes to mark in error.
validate_date_parts in Rust
1.0.1
py rs ts
49 tests
Apache-2.0
money.allocate
Split an amount across ratios without losing or inventing a single minor unit.
allocate in Rust
1.0.1
py rs ts
17 tests
Apache-2.0
money.parse
Parse "£1,234.50" or "1.234,50 €" into integer minor units, strictly: no guessing, no rounding.
parse_money in Rust
1.0.0
py rs ts
37 tests
Apache-2.0
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
1.0.0
py rs ts
52 tests
Apache-2.0
auth.jwt
Sign, verify and decode HS256 JSON Web Tokens (RFC 7519): signature, algorithm and exp/nbf/iat checked with leeway.
A group of 3: sign_jwt, verify_jwt, decode_jwt
1.0.0
py rs ts
54 tests
Apache-2.0
form.character-count
The GOV.UK character count message for a text box: characters or words left or over a limit, with a threshold.
character_count in Rust
1.0.1
py rs ts
32 tests
Apache-2.0
auth.bearer-token
The token from an HTTP Authorization header of the form "Bearer <token>" (RFC 6750), or null if it has none.
parse_bearer_token in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
retail.volumetric-weight
Chargeable parcel weight: the greater of actual and volumetric (dimensional) weight, rounded up to a billing step.
chargeable_weight in Rust
1.0.0
py rs ts
16 tests
Apache-2.0
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
2.0.0
py rs ts
86 tests
Apache-2.0
dates.month-boundaries
The first day, last day and length of the calendar month containing a date.
month_boundaries in Rust
1.0.0
py rs ts
19 tests
Apache-2.0
finance.payment-terms-due-date
Invoice due date from payment terms: net N days, end of month, N days after month end, day N of next month.
payment_due_date in Rust
1.0.0
py rs ts
26 tests
Apache-2.0
dates.bank-holidays
UK bank and public holidays for a region and year, as published by gov.uk, including one-off holidays.
bank_holidays in Rust
1.0.1
py rs ts
15 tests
Apache-2.0 AND OGL-UK-3.0
charity.gift-aid-eligibility
Whether a UK donation qualifies for Gift Aid: declaration, enough tax paid, and the donor benefit limits.
gift_aid_eligibility in Rust
1.0.2
py rs ts
25 tests
Apache-2.0 AND OGL-UK-3.0
charts.scale
Map data values onto screen positions and back: linear, log, time, band and point scales, and nice domains.
A group of 7: linear_scale, invert_linear, nice_domain, log_scale, time_scale, band_scale, point_scale
1.1.0
py rs ts
93 tests
Apache-2.0
subscriptions.mrr-arr
Monthly and annual recurring revenue from a list of subscriptions, normalising intervals and leaving out trials.
mrr_arr in Rust
1.1.0
py rs ts
19 tests
Apache-2.0
stats.standard-deviation
Population or sample standard deviation of a list of numbers, two-pass, rounded to stated decimals.
standard_deviation in Rust
2.0.0
py rs ts
21 tests
Apache-2.0
validation.uk-ni-number
Check a UK National Insurance number's format and HMRC's disallowed prefix letters, and normalise it.
validate_uk_ni_number in Rust
2.0.0
py rs ts
22 tests
Apache-2.0
stats.moving-average
Simple or exponential moving average over a series, one value per full window, rounded to stated decimals.
moving_average in Rust
2.0.0
py rs ts
24 tests
Apache-2.0
validation.phone-e164
Normalise a phone number to E.164 (+447700900123) using a default country's trunk and dialling prefixes.
validate_phone_e164 in Rust
2.0.0
py rs ts
31 tests
Apache-2.0
fleet.emissions
Vehicle greenhouse gas emissions (grams CO2e) from fuel used or distance, using UK government DESNZ conversion factors.
fleet_emissions in Rust
1.0.1
py rs ts
23 tests
Apache-2.0 AND OGL-UK-3.0
energy.carbon-emissions
kgCO2e from kWh or litres of a fuel, using the UK government GHG conversion factors for the year.
carbon_emissions in Rust
1.0.1
py rs ts
17 tests
Apache-2.0 AND OGL-UK-3.0
agri.yield-per-hectare
Crop yield per hectare and per acre from harvested quantity and field area in any area unit, exactly, as decimal text.
yield_per_hectare in Rust
1.0.1
py rs ts
19 tests
Apache-2.0
education.school-year-group
School year group from date of birth on a date, by UK nation: Reception to Year 13, P1 to S6, P1 to Year 14.
school_year_group in Rust
1.0.1
py rs ts
22 tests
Apache-2.0 AND OGL-UK-3.0
banking.faster-payments-limit
Whether a Faster Payment fits the scheme maximum, the bank's per-payment limit and what is left of its daily limit.
faster_payments_check in Rust
1.0.1
py rs ts
24 tests
Apache-2.0
professional.utilisation
Billable utilisation and billing, collection and overall realisation rates, in basis points.
utilisation_rates in Rust
1.0.0
py rs ts
13 tests
Apache-2.0
agri.stocking-rate
Stocking rate: livestock units and LU per hectare from animal numbers, by a published LU coefficient table.
stocking_rate in Rust
1.0.1
py rs ts
17 tests
Apache-2.0 AND OGL-UK-3.0
dates.recurrence
The next n dates of a repeating rule: monthly on a day, last weekday of the month, every k days or weeks, yearly.
recurrence in Rust
1.0.0
py rs ts
25 tests
Apache-2.0
hospitality.recipe-scale
Scale a recipe to a new number of portions, tidying metric units (g to kg, mL to L) and rounding to kitchen precision.
scale_recipe in Rust
1.0.1
py rs ts
26 tests
Apache-2.0
logistics.incoterm-responsibility
Who pays which costs and where risk passes under an Incoterms 2020 rule, from EXW to DDP, FOB and CIF.
incoterm_responsibility in Rust
1.0.1
py rs ts
15 tests
Apache-2.0
hospitality.service-charge
A discretionary service charge on a bill's eligible lines, as a basis-point rate with explicit rounding.
service_charge in Rust
1.0.0
py rs ts
17 tests
Apache-2.0
validation.nhs-number
Check an NHS number's modulus 11 check digit and normalise it to ten digits.
validate_nhs_number in Rust
2.0.0
py rs ts
17 tests
Apache-2.0
education.attendance-rate
Pupil attendance and absence rates in basis points, with the DfE persistent and severe absence flags.
attendance_rate in Rust
1.0.1
py rs ts
19 tests
Apache-2.0 AND OGL-UK-3.0
retail.coupon-validate
Check a coupon against a basket: dates, usage limits, eligible products and minimum spend, with reason codes.
validate_coupon in Rust
1.0.1
py rs ts
24 tests
Apache-2.0
retail.price-per-unit
Unit price for shelf-edge labels: price per kg, per 100 g, per litre, per 100 ml, per metre or per item.
unit_price in Rust
1.0.1
py rs ts
27 tests
Apache-2.0
charts.ticks
Axis ticks: a round step (1, 2 or 5 x 10^k), the ticks on it, and calendar ticks from days to years.
A group of 4: tick_step, nice_ticks, time_tick_interval, time_ticks
1.0.0
py rs ts
57 tests
Apache-2.0
text.slugify
Turn a title into a lowercase ASCII URL slug, transliterating common accented Latin letters.
slugify in Rust
1.0.0
py rs ts
21 tests
Apache-2.0
education.gpa
Grade point average on a 4.0 scale from letter grades and credit hours, weighted by credits and rounded once.
gpa in Rust
1.0.0
py rs ts
22 tests
Apache-2.0
inventory.eoq
Economic order quantity (Harris/Wilson): the order size that minimises ordering plus holding cost, in whole units.
economic_order_quantity in Rust
1.0.0
py rs ts
20 tests
Apache-2.0
net.ipv6
Parse IPv6 addresses and write them in RFC 5952 canonical form: lower-case, zeros compressed, IPv4 embedded.
A group of 3: parse_ipv6, format_ipv6, is_ipv6
1.0.0
py rs ts
47 tests
Apache-2.0
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
1.0.0
py rs ts
61 tests
Apache-2.0
validation.luhn
Check a digit string against the Luhn mod-10 checksum used by payment cards and many identifiers.
is_luhn in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
dates.age
Age in whole years on a given date, with 29 February birthdays ageing on 1 March in other years.
age in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
net.ipv4
Parse, format and check dotted-quad IPv4 addresses, refusing leading zeros, octal, hex and short forms.
A group of 3: parse_ipv4, format_ipv4, is_ipv4
1.0.0
py rs ts
39 tests
Apache-2.0
net.port
Check a TCP/UDP port number and name the IANA service registered on it, with its system/user/dynamic range.
A group of 2: is_port, port_service
1.0.0
py rs ts
30 tests
Apache-2.0
math.fractional-power
Raise a positive decimal to a fractional power, (1.199)^(31/365), identically in every language.
fractional_power in Rust
1.0.0
py rs ts
19 tests
Apache-2.0
monitor.alert-state
Step an alert through inactive, pending, firing and resolved, and say which notification to send.
next_alert_state in Rust
1.0.0
py rs ts
25 tests
Apache-2.0
monitor.counter-increase
How much a monotonic counter grew over a series of samples, counting restarts from zero, and its rate per second.
counter_increase in Rust
1.0.0
py rs ts
14 tests
Apache-2.0
subscriptions.churn
Logo churn, gross and net revenue churn, and gross and net revenue retention for one period, in basis points.
churn_metrics in Rust
1.0.0
py rs ts
15 tests
Apache-2.0
agri.growing-degree-days
Growing degree days (thermal time) from daily min/max temperatures, a base and an optional upper cap.
growing_degree_days in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
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 Rust
1.0.0
py rs ts
24 tests
Apache-2.0
fleet.service-due
Next vehicle service by months or miles, whichever comes first, projecting the mileage date, with an overdue flag.
service_due in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
monitor.uptime
Time-weighted uptime of a target over a window from its checks, with gaps longer than a limit counted as unknown.
uptime in Rust
1.0.0
py rs ts
21 tests
Apache-2.0
units.convert
Convert length, mass, area, volume, temperature and energy between units, exactly, as decimal text.
convert_units in Rust
1.0.0
py rs ts
31 tests
Apache-2.0
validation.uk-modulus-table
Parse Vocalink's VALACDOS.txt and SCSUBTAB.txt into the table UK sort code modulus checking needs.
parse_uk_modulus_table in Rust
1.0.0
py rs ts
28 tests
Apache-2.0
charts.palette
A categorical palette of n colour-blind-safe colours for chart series: Okabe-Ito or Paul Tol's bright scheme.
palette in Rust
1.0.0
py rs ts
12 tests
Apache-2.0
manufacturing.oee
Overall equipment effectiveness (availability x performance x quality) in basis points, from times and counts.
overall_equipment_effectiveness in Rust
1.0.0
py rs ts
18 tests
Apache-2.0
monitor.component-state
A status page component's state from its checks: operational, degraded, partial or major outage, or maintenance.
component_state in Rust
1.0.0
py rs ts
15 tests
Apache-2.0
monitor.incidents
Turn a series of up, degraded and down checks into incidents, ignoring runs too short to confirm.
find_incidents in Rust
1.0.0
py rs ts
19 tests
Apache-2.0
agri.field-area
Field area in square metres, hectares and acres from a boundary polygon of latitude/longitude points.
field_area in Rust
1.0.0
py rs ts
14 tests
Apache-2.0