# concise-readableformatter

> Format content using self-explanatory keywords instead of escaped characters

Latest version **1.0.0** (published 2018-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install concise-readableformatter
pnpm add concise-readableformatter
yarn add concise-readableformatter
bun add concise-readableformatter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-11-07 |
| First published | 2018-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Concise Constructs |
| Maintainers | conciseconstructs |
| Keywords | javascript, js, node, nodejs, format, formatting, string, content, file, fs |

## Links

- npm: https://www.npmjs.com/package/concise-readableformatter
- Repository: https://github.com/ConciseConstructs/concise-readableFormatter
- Homepage: https://github.com/ConciseConstructs/concise-readableFormatter#readme
- Issues: https://github.com/ConciseConstructs/concise-readableFormatter/issues
- npm.io page: https://npm.io/package/concise-readableformatter

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-11-07

## README

# concise-readableFormatter
Format content using self-explanatory keywords instead of escaped characters

## Background
Turn this...
```
function createContent() {

  let content =
    '\t\t\tThis is the title of the content\n'
    + '\n\tGreetings, this is the beginning of the content.'
    + '\n\n\tThis is the second paragraph.'
    + '\n\n'
    + '\tSincerly yours,\n'
    + '\tX.O.'
    + '\n\n\n\n'
    + '~~~~~~~~~~~~~~~~ :-) ~~~~~~~~~~~~~~~~~'

    return content
}

module.exports = createContent()
```

into this...
```
const readableFormatter = require('./ReadableFormatter')
const a = new readableFormatter()

a.custom('paragraphStart', a.newLine + a.indentation)
a.custom('signature', makeSignature())
a.custom('footer', '~~~~~~~~~~~~~~~~ :-) ~~~~~~~~~~~~~~~~~')

function createContent() {

  let content =
    + a.triple('indentation') + `This is the title of the content`
    + a.newLine
    + a.paragraphStart +  `Greetings, this is the beginning of the content. `
    + a.newLine
    + a.paragraphStart + `This is the second paragraph.`
    + a.double('newline')
    + a.signature
    + a.times(4, 'newline')
    + a.footer

    return content
}

function makeSignature() {
  return a.indentation + `Sincerly yours,` + a.newLine
        + a.indentation + `X.O.`
}

module.exports = createContent()
```

### Summary
While writing code that automated the creation of Angular files based on external criteria, I found myself building strings for formatting content within files that was very, very ugly.  I wanted to make the strings and loops that built them read more like natural language.  this readableFormatter achieves this.

---
_Source: https://npm.io/package/concise-readableformatter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
