Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/tornqvist/jazzon-format

Format strings using util.format
https://github.com/tornqvist/jazzon-format

Last synced: about 1 month ago
JSON representation

Format strings using util.format

Awesome Lists containing this project

README

        

# jazzon-format

> Format strings using `util.format`

## Usage

Here is an example where we're using it together with [jazzon-faker](https://github.com/tornqvist/jazzon-faker) to wrap a lipsum text in `p` tags.

```
const jazzon = require('jazzon');
const faker = require('jazzon-faker');
const format = require('jazzon-format');
const json = { title: '@{ lorem.sentences(3) | format(

%s

) }' };

jazzon
.use(faker())
.use(format())
.compile(json)
.then((result) => {
console.log(result); // => { "title": "

Lorem ipsum dolor sit…

" }
});
```

## Licence

MIT