Functional Weave
Code in TypeScript

Stable capabilities

Ordered by level: primitives at the bottom of the graph, workflows at the top. Each one carries its own tests, at least 8 per function.

Suites — the capabilities a kind of app is built from: accounting, payroll, an online shop, a clinic…

Collection: React form elements — accessible form components for React, and the pure helpers they use.

Level 0 primitive

encoding.base64
Bytes to base64 and base64url text and back (RFC 4648), with strict decoding, identically in every language.
A group of 4: base64Encode, base64Decode, base64UrlEncode, base64UrlDecode
encoding.hex
Bytes to lowercase hexadecimal text and back (RFC 4648 base16), strictly, identically in every language.
A group of 2: hexEncode, hexDecode
math.exp
e to the power x from + - * / only, so TypeScript, Python and Rust return the same double for the same input.
exp in TypeScript
math.round-float
Round a float half away from zero to 0-12 decimal places, identically in TypeScript, Python and Rust.
roundFloat in TypeScript
text.mask
Mask all but the last n characters of a card, account or phone number, optionally keeping separators.
mask in TypeScript
encoding.utf8
Text to UTF-8 bytes and strictly back (RFC 3629), so hashing and signing see the same bytes in every language.
A group of 2: utf8Encode, utf8Decode
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: convertRate, toBasisPoints, fromBasisPoints
math.clamp
Clamp an integer to an inclusive range, refusing a range whose bounds are the wrong way round.
clamp in TypeScript
math.pow
base to the power exponent from + - * / only, exact by squaring for whole exponents, identical in every language.
pow in TypeScript
math.sin-cos
Sine and cosine of an angle in radians from + - * / only, so every language returns the same doubles.
sinCos in TypeScript
charts.contrast
WCAG 2.x contrast ratio between two colours, and which text colour reads best on a background.
A group of 2: contrastRatio, readableTextColor
charts.color
Hex colours to RGB and back, and sRGB channels to linear light and back, identically in every language.
A group of 4: parseHex, toHex, srgbToLinear, linearToSrgb
charts.extent
The minimum and maximum of a series as [min, max], skipping gaps (null), or null when there is no value.
extent in TypeScript

Level 1 generic concept

money.compare
Compare two amounts of one currency, refusing to compare across currencies; min, max and clamp too.
A group of 4: compareMoney, minMoney, maxMoney, clampMoney
money.parse
Parse "£1,234.50" or "1.234,50 €" into integer minor units, strictly: no guessing, no rounding.
parseMoney in TypeScript
net.ipv4
Parse, format and check dotted-quad IPv4 addresses, refusing leading zeros, octal, hex and short forms.
A group of 3: parseIpv4, formatIpv4, isIpv4
react.form.form-field React ^19 · TypeScript only
Wire a label, hint and error message to one form control by id, the accessible way (GOV.UK form group pattern).
A group of 2: fieldIds, FormField
fleet.emissions
Vehicle greenhouse gas emissions (grams CO2e) from fuel used or distance, using UK government DESNZ conversion factors.
fleetEmissions in TypeScript
net.ipv6
Parse IPv6 addresses and write them in RFC 5952 canonical form: lower-case, zeros compressed, IPv4 embedded.
A group of 3: parseIpv6, formatIpv6, isIpv6
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: signJwt, verifyJwt, decodeJwt
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: tickStep, niceTicks, timeTickInterval, timeTicks
math.rational
Exact fraction arithmetic, always reduced, for rates and ratios that must not drift.
A group of 8: calculateRational, rational, addRational, subtractRational, multiplyRational, divideRational, compareRational, rationalToInteger
react.form.button React ^19 · TypeScript only
A form button in primary, secondary or warning style that stays focusable while loading (GOV.UK button).
Button in TypeScript
charts.format
Axis and label text for charts: tick numbers, SI prefixes (1.2k, 3.4M), percentages, dates and money.
A group of 5: formatTick, formatSi, formatPercent, formatDate, formatMoneyTick
money.sum
Total a list of monetary amounts, with an explicit currency for the empty case.
sumMoney in TypeScript
net.cidr
CIDR blocks: network, broadcast, first and last host, host count, netmask and prefix, and membership.
A group of 5: cidrInfo, cidrContains, isCidr, prefixToNetmask, netmaskToPrefix
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: isPort, portService
react.form.styles React ^19 · TypeScript only
An optional stylesheet for the react.form elements' caps-* classes, themed by --caps-form-* custom properties.
formStyles in TypeScript
text.slugify
Turn a title into a lowercase ASCII URL slug, transliterating common accented Latin letters.
slugify in TypeScript
charts.scale
Map data values onto screen positions and back: linear, log, time, band and point scales, and nice domains.
A group of 7: linearScale, invertLinear, niceDomain, logScale, timeScale, bandScale, pointScale

Level 2 domain function

auth.access-token
Issue an API's HS256 access token, read one from an Authorization header, and refuse revoked or superseded ones.
A group of 3: issueAccessToken, readAccessToken, confirmAccessToken
dates.uk-tax-year
The UK personal tax year containing a date: 6 April to 5 April, with HMRC's label.
ukTaxYear in TypeScript
todo.due-label
The short English label shown next to a todo: "2 days overdue", "Due today", "Due tomorrow", "Due Fri 2 Oct".
dueLabel in TypeScript
charts.axis
Axis geometry as data: tick positions, tick marks, label anchors and gridlines for number, time and category axes.
A group of 5: axisFromTicks, numberAxis, timeAxis, bandAxis, gridLines
charts.shape
SVG path strings for lines, areas, steps, monotone curves, bars, arcs and pie slices, identical in every language.
A group of 7: linePath, areaPath, stepPath, monotoneCurve, barRects, arcPath, pieAngles
retail.oss-vat
EU distance-selling VAT: which member state's standard rate applies under OSS and the EUR 10,000 threshold, and the VAT.
ossVat in TypeScript
todo.due-status
Where a todo stands against its due date today: done, overdue, today, tomorrow, this week, later or no date.
dueStatus in TypeScript
todo.export-csv
Write todos as a CSV file (RFC 4180) with one column per field, for backups, spreadsheets and other apps.
exportCsv in TypeScript
todo.item
The to-do item type (Todo, TodoDraft, Recurrence) and its validators, with a message per field.
A group of 2: validateDraft, validateTodo
auth.password-hash
Hash a password for storage as pbkdf2_sha256$iterations$salt$hash, verify one in constant time, and spot weak hashes.
A group of 3: hashPassword, verifyPassword, passwordNeedsRehash
charts.layout
Chart layout: the plot area inside margins, legend items wrapped into rows, and greedy label collision avoidance.
A group of 3: plotArea, legendRows, avoidCollisions

Level 3 business operation