Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kamataryo/outdent


https://github.com/kamataryo/outdent

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# outdent

Outdent is a simple here document generator with pretty indents.

## install

```shell
$ npm install @kamataryo/outdent
# or
$ yarn add @kamataryo/outdent
# or
$ bun install @kamataryo/outdent
```

## usage

```typescript
import { test, expected } from 'bun:test'

test('the example in README', () => {
let expected, actual
{
{
{
// not pretty 🤔
expected = `Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`
}
}
}

{
{
{
// pretty 🥺
actual = outdent`
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
`
}
}
}

expect(actual).toBe(expected)
})
```