Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderaiser/rendy
simple template engine compatible with handlebars and mustache
https://github.com/coderaiser/rendy
hacktoberfest handlebars javascript mustache nodejs render template
Last synced: 3 months ago
JSON representation
simple template engine compatible with handlebars and mustache
- Host: GitHub
- URL: https://github.com/coderaiser/rendy
- Owner: coderaiser
- License: mit
- Created: 2014-12-12T07:21:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-12T08:01:05.000Z (over 1 year ago)
- Last Synced: 2024-11-10T09:05:06.484Z (3 months ago)
- Topics: hacktoberfest, handlebars, javascript, mustache, nodejs, render, template
- Language: JavaScript
- Homepage:
- Size: 72.3 KB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Rendy [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage][CoverageIMGURL]][CoverageURL]
[NPM_INFO_IMG]: https://nodei.co/npm/rendy.png?downloads&&stars&&downloadRank "npm install rendy"
[NPMIMGURL]: https://img.shields.io/npm/v/rendy.svg?style=flat
[BuildStatusURL]: https://github.com/coderaiser/rendy/actions/workflows/nodejs.yml "Build Status"
[BuildStatusIMGURL]: https://github.com/coderaiser/rendy/actions/workflows/nodejs.yml/badge.svg
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/rendy "npm"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[CoverageURL]: https://coveralls.io/github/coderaiser/rendy?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/rendy/badge.svg?branch=master&service=githubSimple template engine compatible with [handlebars](http://handlebarsjs.com "Handlebars") and [mustache](https://mustache.github.io "Mustache").
## Install
![NPM\_INFO][NPM_INFO_IMG]
`npm i rendy`
## How to use?
In **ESM**
```js
import rendy from 'rendy';
```in **CommonJS**:
```js
const rendy = require('rendy');
```### API
#### rendy(template: string, value: Values, modifiers?: Modifiers)
`Values` is:
```ts
type Values = {
[key: string]: unknown;
};
type Modifiers = {
[key: string]: (value: unknown) => string;
};
``````js
rendy('hello {{ value }}', {
value: 'world',
});// returns
'hello world';const values = {
names: ['a', 'b', 'c'],
};const modifiers = {
implode: (a) => a.join(', '),
};rendy('hello {{ names | implode }}', values, modifiers);
// returns
'hello a, b, c';
```## License
MIT