[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › Leancase

**`Experimental`**

Leancase, a minimal writing style as a normal form.

Leancase marks each boundary once. A line break already ends a sentence, so a
final period repeats it. A period between sentences already starts the next
one, so a capital letter repeats it. Leancase drops the repeats and, for a
uniform look, every other capital letter too:

- Everything is lowercase, including sentence starts, names, acronyms, and the
  pronoun I.
- Code in backticks or a code fence, URLs with a scheme, @handles, and
  #hashtags keep their case, because changing it can break them or change
  their meaning.
- A line that ends a sentence has no final period, but an ellipsis stays.
  Periods between sentences on the same line stay.
- Nothing else changes: wording, other punctuation, whitespace, and line breaks
  stay.

[leancase](https://evolu.dev/docs/api-reference/common/Leancase/functions/leancase) converts plain text, such as a post or a chat message, where
every line break is a visible one. Converting leancase text again changes
nothing, so leancase text is exactly the text [leancase](https://evolu.dev/docs/api-reference/common/Leancase/functions/leancase) leaves
unchanged, and [LeancasedString](https://evolu.dev/docs/api-reference/common/Leancase/variables/LeancasedString) validates it that way.

Markdown is not supported. A soft line break inside a Markdown paragraph
renders as a space, so removing the period before it would merge two
sentences.

Leancase is experimental. Its rules may change in a minor or patch release.

### Example

```ts
import { assertEqual, leancase } from "@evolu/common";

const docs = "https://evolu.dev/docs/api-reference/common/Leancase";

assertEqual(
  leancase(`I like Evolu. See ${docs}.\nThanks, @Steida.`),
  `i like evolu. see ${docs}\nthanks, @Steida`,
);
```

## Functions

| Function                                                               | Description                                                                                                                         |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [leancase](https://evolu.dev/docs/api-reference/common/Leancase/functions/leancase) | Converts plain text to leancase and returns a [LeancasedString](https://evolu.dev/docs/api-reference/common/Leancase/variables/LeancasedString). |

## Interfaces

| Interface                                                                           | Description                                                                                                    |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [LeancasedError](https://evolu.dev/docs/api-reference/common/Leancase/interfaces/LeancasedError) | Error returned when [leancased](https://evolu.dev/docs/api-reference/common/Leancase/variables/leancased) rejects a string. |

## Type Aliases

| Type Alias                                                                              | Description                                                                   |
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [LeancasedString](https://evolu.dev/docs/api-reference/common/Leancase/type-aliases/LeancasedString) | A [String](https://evolu.dev/docs/api-reference/common/Type/variables/String) in leancase. |

## Variables

| Variable                                                                             | Description                                                                   |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- |
| [leancased](https://evolu.dev/docs/api-reference/common/Leancase/variables/leancased)             | Adds leancase validation to an existing string Type.                          |
| [LeancasedString](https://evolu.dev/docs/api-reference/common/Leancase/variables/LeancasedString) | A [String](https://evolu.dev/docs/api-reference/common/Type/variables/String) in leancase. |