The catalogue — Toopo

4 utility functions with a published contract: a signature, property-based invariants, and every edge case named and settled. The source is copied into your project.

[toopo](../)

- [How we verify](../method/)

# The catalogue

Utility functions you copy into your project, each verified against a public, executable contract. Not a dependency: the source lands in your repository and it is yours.

```
`npx toopo add domain/function`
```

Every contract carries its own command, on its own page. This is the shape of all of them.

A contract is the whole behavioural specification of one function — its signature, the invariants that must hold for every input, and every edge case named, settled and argued for. Anything that satisfies it can replace anything else that does, which is what makes an implementation a detail. The contract is what this project publishes; the code is what it hands you.

## 5 contracts in 4 domains

### [number](../typescript/number/)

- [parse](../typescript/number/parse@1/)

### [date](../typescript/date/)

- [add](../typescript/date/add@1/)

### [array](../typescript/array/)

- [group-by](../typescript/array/group-by@1/) — turned down

### [string](../typescript/string/)

- [levenshtein](../typescript/string/levenshtein@1/)
- [slugify](../typescript/string/slugify@1/)

## How we verify

**692** defect cells injected

**659** caught by the suite

**19** batteries, replayable

A test suite that has never failed proves nothing. Every contract here is measured by breaking the implementation on purpose and requiring the suite to notice — and what those measurements did not catch is published beside what they did. They measure what the tests notice, which is not the same as what the code does.

[How we verify, and what it does not prove](../method/)

## What we refuse

1 of these 5 was written in full and then turned down. What they were turned down for, and the measurement each decision rests on, is published beside them.

[What we refuse, and why](../refused/)

## What the command does

It copies files. Nothing is added to your package.json, nothing of ours runs in your build, and a lockfile records what was served and what was written — so a file you edited is never overwritten and one that moved is named.

- `init` — configure where features go.
- `add` — install a feature and what it imports.
- `remove` — show what would go, then take it out.
- `update` — show what would change, then write it.
- `list` — what this project holds.
- `search` — find a contract, or list the catalogue.

## What a contract is

The whole specification of one function: its signature, the invariants that must hold for every input, and every edge case named, settled and argued for. A contribution can be an implementation, or an input where ours is wrong — never a contract.

[A contract is the whole specification of one function](../what-a-contract-is/)
