https://github.com/sirodiaz/templyte
Simple Javascript string template. Useful for simple string translations and text replacing.
https://github.com/sirodiaz/templyte
javascript javascript-library nodejs nodejs-library nodejs-modules template template-engine template-literals template-string
Last synced: 28 days ago
JSON representation
Simple Javascript string template. Useful for simple string translations and text replacing.
- Host: GitHub
- URL: https://github.com/sirodiaz/templyte
- Owner: SiroDiaz
- License: mit
- Created: 2018-06-09T10:28:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-09-21T18:15:32.000Z (over 3 years ago)
- Last Synced: 2025-09-29T15:52:33.082Z (8 months ago)
- Topics: javascript, javascript-library, nodejs, nodejs-library, nodejs-modules, template, template-engine, template-literals, template-string
- Language: TypeScript
- Homepage: https://github.com/SiroDiaz/templyte
- Size: 162 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# templyte
[![Software License][ico-license]](LICENSE.md)
[](https://github.com/SiroDiaz/templyte/actions/workflows/test.yml)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3XKLA6VTYVSKW&source=url)
Simple and lightweight Javascript string template. Useful for simple string translations and text replacing.
## install
You can install it if your Node.JS version is >= 14.x. Then run the following command:
```bash
> npm install templyte --save
```
## usage
Templyte is quite simple and easy to use. Just one method for render a string.
```javascript
const templyte = require('templyte');
let myString = templyte.renderString('Hello {{who}}!', {who: 'world'});
console.log(myString); // Hello world!
```
Also you can use a custom template tag like *"[[ variable ]]"* just adding third parameter to
renderString method.
```javascript
const templyte = require('templyte');
const delimiters = ['[[', ']]'];
let myString = templyte.renderString('Hello [[who]]!', {who: 'world'}, delimiters);
```
The renderString will escape the delimiters for regular expression security.
## Security
If you discover any security related issues, use the issue tracker.
## Credits
- [Siro Díaz Palazón][link-author]
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/SiroDiaz/templyte/master.svg?style=flat-square
[link-author]: https://github.com/SiroDiaz
[link-travis]: https://travis-ci.org/SiroDiaz/templyte