https://github.com/klippersubs/taghelper
Helper functions for creating template literal tags.
https://github.com/klippersubs/taghelper
template-string
Last synced: 7 months ago
JSON representation
Helper functions for creating template literal tags.
- Host: GitHub
- URL: https://github.com/klippersubs/taghelper
- Owner: klippersubs
- License: mit
- Created: 2017-04-09T10:14:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-10T12:36:53.000Z (almost 9 years ago)
- Last Synced: 2025-08-28T08:10:13.345Z (7 months ago)
- Topics: template-string
- Language: TypeScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# taghelper
> Helper functions for creating template literal tags.
## Install
````bash
npm install --save taghelper
````
## API
### `merge`
Merges template strings and values arrays into one.
Arguments:
1. `strings : TemplateStringsArray` — template strings.
2. `rest : any[]` — template values.
3. `options : IMergeOptions = {}` — [options](#imergeoptions).
Returns: `any[]` — two arrays merged into one.
### `join`
Joins both template strings and values into one string.
Arguments:
1. `strings : TemplateStringsArray` — template strings.
2. `rest : any[]` — template values.
3. `options : IMergeOptions = {}` — [options](#imergeoptions) for `merge` function.
NB: `stringify` option is useless here.
Returns: `string` — resulting string.
### `taglike`
Returns `true`, if it looks like supplied parameters
are template strings and values arrays.
Arguments:
1. `strings : TemplateStringsArray` — template strings.
2. `rest : any[]` — template values.
Returns: `boolean`.
### `IMergeOptions`
* `stringify : boolean = false` — if `true`, template values will be converted to strings.
* `raw : boolean = false` — if `true`, raw values of strings will be used.
## License
MIT