https://github.com/seregpie/tag
Parses a template literal to a function.
https://github.com/seregpie/tag
Last synced: about 2 months ago
JSON representation
Parses a template literal to a function.
- Host: GitHub
- URL: https://github.com/seregpie/tag
- Owner: SeregPie
- License: mit
- Created: 2020-10-13T14:09:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-10-17T15:07:24.000Z (over 4 years ago)
- Last Synced: 2024-02-22T22:06:53.409Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tag
Parses a template literal to a function.
## setup
### npm
```shell
npm i @seregpie/tag
```---
Import inside an ES module.
```javascript
import tag from '@seregpie/tag';
```*or*
Import inside a CommonJS module.
```javascript
let tag = require('@seregpie/tag');
```### browser
```html
```
The function is globally available as `tag`.
## usage
```javascript
let renderTemplate = tag`Hi, ${'name'}!`;
let string = renderTemplate({name: 'Patrik'});
// => 'Hi, Patrik!'
```