1 # ![common-tags](media/logo.svg)
3 π A set of **well-tested**, commonly used template literal tag functions for use in ES2015+.
5 π Plus some extra goodies for easily making your own tags.
10 import { html } from 'common-tags';
22 | ---------- | ---------------------------------------- |
23 | Version | [![github release](https://img.shields.io/github/release/declandewet/common-tags.svg?style=flat-square)](https://github.com/declandewet/common-tags/releases/latest) [![npm version](https://img.shields.io/npm/v/common-tags.svg?style=flat-square)](http://npmjs.org/package/common-tags) |
24 | License | [![npm license](https://img.shields.io/npm/l/common-tags.svg?style=flat-square)](https://github.com/declandewet/common-tags/blob/master/license.md) |
25 | Popularity | [![npm downloads](https://img.shields.io/npm/dm/common-tags.svg?style=flat-square)](http://npm-stat.com/charts.html?package=common-tags) |
26 | Testing | [![Build status](https://ci.appveyor.com/api/projects/status/75eiommx0llt3sgd?svg=true)](https://ci.appveyor.com/project/declandewet/common-tags) [![build status](https://img.shields.io/travis/declandewet/common-tags.svg?style=flat-square)](https://travis-ci.org/declandewet/common-tags) [![codecov.io](https://img.shields.io/codecov/c/gh/declandewet/common-tags.svg?style=flat-square)](https://codecov.io/gh/declandewet/common-tags?branch=master) |
27 | Quality | [![bitHound Overall Score](https://www.bithound.io/github/declandewet/common-tags/badges/score.svg)](https://www.bithound.io/github/declandewet/common-tags) [![dependency status](https://img.shields.io/david/declandewet/common-tags.svg?style=flat-square)](https://david-dm.org/declandewet/common-tags) [![dev dependency status](https://img.shields.io/david/dev/declandewet/common-tags.svg?style=flat-square)](https://david-dm.org/declandewet/common-tags#info=devDependencies) |
28 | Style | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) |
30 <!-- START doctoc generated TOC please keep comment here to allow auto update -->
31 <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
34 - [Introduction](#introduction)
35 - [Why You Should Care](#why-you-should-care)
36 - [See Who Is Using `common-tags`](#see-who-is-using-common-tags)
37 - [Installation](#installation)
38 - [Requirements](#requirements)
39 - [Instructions](#instructions)
40 - [With unpkg](#with-unpkg)
43 - [Available Tags](#available-tags)
45 - [Aliases: `source`, `codeBlock`](#aliases-source-codeblock)
46 - [`safeHtml`](#safehtml)
47 - [`oneLine`](#oneline)
48 - [`oneLineTrim`](#onelinetrim)
49 - [`stripIndent`](#stripindent)
50 - [`stripIndents`](#stripindents)
51 - [`inlineLists`](#inlinelists)
52 - [`oneLineInlineLists`](#onelineinlinelists)
53 - [`commaLists`](#commalists)
54 - [`commaListsOr`](#commalistsor)
55 - [`commaListsAnd`](#commalistsand)
56 - [`oneLineCommaLists`](#onelinecommalists)
57 - [`oneLineCommaListsOr`](#onelinecommalistsor)
58 - [`oneLineCommaListsAnd`](#onelinecommalistsand)
59 - [Advanced Usage](#advanced-usage)
60 - [Tail Processing](#tail-processing)
61 - [Using Tags on Regular String Literals](#using-tags-on-regular-string-literals)
62 - [Type Definitions](#type-definitions)
63 - [Make Your Own Template Tag](#make-your-own-template-tag)
64 - [Class is in Session: TemplateTag](#class-is-in-session-templatetag)
65 - [The Anatomy of a Transformer](#the-anatomy-of-a-transformer)
66 - [Plugin Transformers](#plugin-transformers)
67 - [Plugin Pipeline](#plugin-pipeline)
68 - [Returning Other Values from a Transformer](#returning-other-values-from-a-transformer)
69 - [List of Built-in Transformers](#list-of-built-in-transformers)
70 - [`trimResultTransformer([side])`](#trimresulttransformerside)
71 - [`stripIndentTransformer([type='initial'])`](#stripindenttransformertypeinitial)
72 - [`replaceResultTransformer(replaceWhat, replaceWith)`](#replaceresulttransformerreplacewhat-replacewith)
73 - [`replaceSubstitutionTransformer(replaceWhat, replaceWith)`](#replacesubstitutiontransformerreplacewhat-replacewith)
74 - [`replaceStringTransformer(replaceWhat, replaceWith)`](#replacestringtransformerreplacewhat-replacewith)
75 - [`inlineArrayTransformer(opts)`](#inlinearraytransformeropts)
76 - [`splitStringTransformer(splitBy)`](#splitstringtransformersplitby)
77 - [How to Contribute](#how-to-contribute)
79 - [Other ES2015 Template Tag Modules](#other-es2015-template-tag-modules)
81 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
85 `common-tags` initially started out as two template tags I'd always find myself writing - one for stripping indents, and one for trimming multiline strings down to a single line. In it's prime, I was an avid user of [CoffeeScript](http://coffeescript.org), which had this behaviour by default as part of it's block strings feature. I also started out programming in Ruby, which has a similar mechanism called Heredocs.
87 Over time, I found myself needing a few more template tags to cover edge cases - ones that supported including arrays, or ones that helped to render out tiny bits of HTML not large enough to deserve their own file or an entire template engine. So I packaged all of these up into this module.
89 As more features were proposed, and I found myself needing a way to override the default settings to cover even more edge cases, I realized that my initial implementation wouldn't be easy to scale.
91 So I re-wrote this module on top of a core architecture that makes use of transformer plugins which can be composed, imported independently and re-used.
93 ## Why You Should Care
95 Tagged templates in ES2015 are a welcome feature. But, they have their downsides. One such downside is that they preserve all whitespace by default - which makes multiline strings in source code look terrible.
97 Source code is not just for computers to interpret. Humans have to read it too π. If you care at all about how neat your source code is, or come from a [CoffeeScript](http://coffeescript.org/) background and miss the [block string syntax](http://coffeescript.org/#strings), then you will love `common-tags`, as it was initially intended to bring this feature "back" to JS since it's [initial commit](https://github.com/declandewet/common-tags/commit/2595288d6c276439d98d1bcbbb0aa113f4f7cd86).
99 `common-tags` also [exposes a means of composing pipelines of dynamic transformer plugins](#plugin-transformers). As someone with a little experience writing tagged templates, I can admit that it is often the case that one tag might need to do the same thing as another tag before doing any further processing; for example - a typical tag that renders out HTML could strip initial indents first, then worry about handling character escapes. Both steps could easily be useful as their own separate template tags, but there isn't an immediately obvious way of composing the two together for maximum re-use. `common-tags` offers not [one](#tail-processing), but [two](#plugin-pipeline) ways of doing this.
101 Furthermore, I try to keep this project as transparently stable and updated as frequently as I possibly can. As you may have already seen by the [project status table](#project-status), `common-tags` is linted, well tested, tests are well covered, tests pass on both Unix and Windows operating systems, the popularity bandwidth is easily referenced and dependency health is in plain sight π. `common-tags` is also already [used in production on a number of proprietary sites and dependent projects](#see-who-is-using-common-tags), and [contributions are always welcome](#how-to-contribute), as are [suggestions](issues).
103 ## See Who Is Using `common-tags`
105 - **[Slack](https://slack.com/)** ([ref](https://slack.com/libs/desktop))
106 - **[Discord](https://discordapp.com)** ([ref](https://discordapp.com/acknowledgements))
107 - **[CircleCI](https://circleci.com)** ([ref](https://circleci.com/docs/2.0/open-source/))
108 - **[Confluent](https://www.confluent.io/)** ([ref](https://www.confluent.io/third_party_software/))
109 - **[Tessel](https://tessel.io/)** ([ref](https://github.com/tessel/t2-cli/blob/575ddb23f432d10f86b76f5cdca866d1146dedf5/package.json#L56))
110 - **[Ember.js](https://www.emberjs.com/)** ([ref](https://github.com/emberjs/ember.js/blob/cacefee49ea4be2621a0ced3e4ceb0010d6cd841/package.json#L93))
111 - **[Angular](https://angularjs.org/)** ([ref](https://github.com/angular/angular-cli/blob/90e2e805aae6e0bd2e00e52063221736a8d9cb0c/package.json#L50))
112 - **[Prettier](https://prettier.io/)** ([ref](https://github.com/prettier/prettier-eslint/blob/49b762b57b7e7af3b06bd933050c614a91b6742d/package.json#L18))
113 - **[Apollo](https://www.apollographql.com)** ([ref](https://github.com/apollographql/apollo-codegen/blob/b9b9a2afd851fa3cba786b26684b26378b1a6f53/package.json#L48))
114 - **[Workbox](https://developers.google.com/web/tools/workbox/)** ([ref](https://github.com/GoogleChrome/workbox/blob/d391a0cb51b3e89121c5274fb15f05988233b57e/package.json#L64))
115 - **[Gatsby](https://www.gatsbyjs.org/)** ([ref](https://github.com/gatsbyjs/gatsby/blob/3af191c9961b6da1cc04e9cb0a03787af25878db/packages/gatsby-cli/package.json#L16))
116 - **[Storybook](https://storybook.js.org/)** ([ref](https://github.com/storybooks/storybook/blob/c275e5c508714bd1a49342e51ddf00bbdb54d277/app/react/package.json#L46))
117 - **[Cypress](https://www.cypress.io/)** ([ref](https://github.com/cypress-io/cypress/blob/5d761630f233abb30b9b2e3fede9a4c4887cf880/cli/package.json#L44))
118 - **[stylelint](http://stylelint.io/)** ([ref](https://github.com/stylelint/stylelint/blob/5dc5db5599a00cabc875cf99c56d60f93fbbbd2d/package.json#L82))
119 - **[pnpm](https://pnpm.js.org/)** ([ref](https://github.com/pnpm/pnpm/blob/36be3d3f0c75992a1f3ff14b60c99115547d0fcc/package.json#L36))
120 - **[jss](http://cssinjs.org/)** ([ref](https://github.com/cssinjs/jss/blob/7b9c1222893495c585b4b61d7ca9af05077cefec/package.json#L44))
126 The official recommendation for running `common-tags` is as follows:
128 - [Node.js](https://nodejs.org/en/download/) v5.0.0 or higher
129 - In order to use `common-tags`, your environment will also need to support ES2015 tagged templates ([pssst⦠check Babel out](http://babeljs.io))
130 - You might also want to [polyfill some features](https://github.com/zloirock/core-js) if you plan on supporting older browsers: `Array.prototype.includes`
132 It might work with below versions of Node, but this is not a guarantee.
136 `common-tags` is a [Node](https://nodejs.org/) module. So, as long as you have Node.js and NPM installed, installing `common-tags` is as simple as running this in a terminal at the root of your project:
139 npm install common-tags
144 `common-tags` is also available at [unpkg](https://unpkg.com/common-tags). Just put this code in your HTML:
147 <script src="https://unpkg.com/common-tags"></script>
150 This will make the library available under a global variable `commonTags`.
156 Like all modules, `common-tags` begins with an `import`. In fact, `common-tags` supports two styles of import:
161 import {stripIndent} from 'common-tags'
164 **Direct module imports:**
166 *(Useful if your bundler doesn't support [tree shaking](https://medium.com/@roman01la/dead-code-elimination-and-tree-shaking-in-javascript-build-systems-fb8512c86edf#.p30lbjm94) but you still want to only include modules you need).*
169 import stripIndent from 'common-tags/lib/stripIndent'
174 `common-tags` exports a bunch of wonderful pre-cooked template tags for your eager consumption. They are as follows:
178 ##### Aliases: `source`, `codeBlock`
180 You'll often find that you might want to include an array in a template. Typically, doing something like `${array.join(', ')}` would work - but what if you're printing a list of items in an HTML template and want to maintain the indentation? You'd have to count the spaces manually and include them in the `.join()` call - which is a bit *ugly* for my taste. This tag properly indents arrays, as well as newline characters in string substitutions, by converting them to an array split by newline and re-using the same array inclusion logic:
183 import {html} from 'common-tags'
184 let fruits = ['apple', 'orange', 'watermelon']
188 ${fruits.map(fruit => `<li>${fruit}</li>`)}
189 ${'<li>kiwi</li>\n<li>guava</li>'}
211 A tag very similar to `html` but it does safe HTML escaping for strings coming from substitutions. When combined with regular `html` tag, you can do basic HTML templating that is safe from XSS (Cross-Site Scripting) attacks.
214 import {html, safeHtml} from 'common-tags'
215 let userMessages = ['hi', 'what are you up to?', '<script>alert("something evil")</script>']
217 <div class="chat-list">
219 ${userMessages.map(message => safeHtml`<li>${message}</li>`)}
228 <div class="chat-list">
231 <li>what are you up to?</li>
232 <li><script>alert("something evil")</script></li>
239 Allows you to keep your single-line strings under 80 characters without resorting to crazy string concatenation.
242 import {oneLine} from 'common-tags'
254 Allows you to keep your single-line strings under 80 characters while trimming the new lines:
257 import {oneLineTrim} from 'common-tags'
260 https://news.com/article
261 ?utm_source=designernews.co
263 // https://news.com/article?utm_source=designernews.co
268 If you want to strip the initial indentation from the beginning of each line in a multiline string:
271 import {stripIndent} from 'common-tags'
274 This is a multi-line string.
275 You'll ${verb} that it is indented.
276 We don't want to output this indentation.
277 But we do want to keep this line indented.
279 // This is a multi-line string.
280 // You'll notice that it is indented.
281 // We don't want to output this indentation.
282 // But we do want to keep this line indented.
285 Important note: this tag will not indent multiline strings coming from the substitutions. If you want that behavior, use the `html` tag (aliases: `source`, `codeBlock`).
289 If you want to strip *all* of the indentation from the beginning of each line in a multiline string:
292 import {stripIndents} from 'common-tags'
295 This is a multi-line string.
296 You'll ${verb} that it is indented.
297 We don't want to output this indentation.
298 We don't want to keep this line indented either.
300 // This is a multi-line string.
301 // You'll notice that it is indented.
302 // We don't want to output this indentation.
303 // We don't want to keep this line indented either.
308 Allows you to inline an array substitution as a list:
311 import {inlineLists} from 'common-tags'
314 I like ${['apples', 'bananas', 'watermelons']}
317 // I like apples bananas watermelons
321 #### `oneLineInlineLists`
323 Allows you to inline an array substitution as a list, rendered out on a single line:
326 import {oneLineInlineLists} from 'common-tags'
329 I like ${['apples', 'bananas', 'watermelons']}
332 // I like apples bananas watermelons They're good!
337 Allows you to inline an array substitution as a comma-separated list:
340 import {commaLists} from 'common-tags'
343 I like ${['apples', 'bananas', 'watermelons']}
346 // I like apples, bananas, watermelons
352 Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "or":
355 import {commaListsOr} from 'common-tags'
358 I like ${['apples', 'bananas', 'watermelons']}
361 // I like apples, bananas or watermelons
367 Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "and":
370 import {commaListsAnd} from 'common-tags'
373 I like ${['apples', 'bananas', 'watermelons']}
376 // I like apples, bananas and watermelons
380 #### `oneLineCommaLists`
382 Allows you to inline an array substitution as a comma-separated list, and is rendered out on to a single line:
385 import {oneLineCommaLists} from 'common-tags'
388 I like ${['apples', 'bananas', 'watermelons']}
391 // I like apples, bananas or watermelons They're good!
394 #### `oneLineCommaListsOr`
396 Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "or", and is rendered out on to a single line:
399 import {oneLineCommaListsOr} from 'common-tags'
402 I like ${['apples', 'bananas', 'watermelons']}
405 // I like apples, bananas or watermelons They're good!
408 #### `oneLineCommaListsAnd`
410 Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "and", and is rendered out on to a single line:
413 import {oneLineCommaListsAnd} from 'common-tags'
415 oneLineCommaListsAnd`
416 I like ${['apples', 'bananas', 'watermelons']}
419 // I like apples, bananas and watermelons They're good!
426 It's possible to pass the output of a tagged template to another template tag in pure ES2015+:
429 import {oneLine} from 'common-tags'
440 We can make this neater. Every tag `common-tags` exports can delay execution if it receives a function as it's first argument. This function is assumed to be a template tag, and is called via an intermediary tagging process before the result is passed back to our tag. Use it like so (this code is equivalent to the previous code block):
443 import {oneLine} from 'common-tags'
452 ### Using Tags on Regular String Literals
454 Sometimes you might want to use a tag on a normal string (e.g. for stripping the indentation). For that purpose just call a tag as a function with the passed string:
457 import {stripIndent} from 'common-tags'
459 stripIndent(" foo\n bar")
465 There are third-party type definitions for `common-tags` on [npm](https://www.npmjs.com/package/@types/common-tags). Just install them like so:
468 npm install @types/common-tags
471 Please note that these type definitions are not officially maintained by the authors of
472 `common-tags` - they are maintained by the TypeScript community.
474 ### Make Your Own Template Tag
476 `common-tags` exposes an interface that allows you to painlessly create your own template tags.
478 #### Class is in Session: TemplateTag
480 `common-tags` exports a `TemplateTag` class. This class is the foundation of `common-tags`. The concept of the class works on the premise that transformations occur on a template either when the template is finished being processed (`onEndResult`), or when the tag encounters a string (`onString`) or a substitution (`onSubstitution`). Any tag produced by this class supports [tail processing](#tail-processing).
482 The easiest tag to create is a tag that does nothing:
485 import {TemplateTag} from 'common-tags'
487 const doNothing = new TemplateTag()
493 #### The Anatomy of a Transformer
495 `TemplateTag` receives either an array or argument list of `transformers`. A `transformer` is just a plain object with three optional methods - `onString`, `onSubstitution` and `onEndResult` - it looks like this:
500 // optional. Called when the tag encounters a string.
501 // (a string is whatever's not inside "${}" in your template literal)
502 // `str` is the value of the current string
504 onSubstitution (substitution, resultSoFar) {
505 // optional. Called when the tag encounters a substitution.
506 // (a substitution is whatever's inside "${}" in your template literal)
507 // `substitution` is the value of the current substitution
508 // `resultSoFar` is the end result up to the point of this substitution
510 onEndResult (endResult) {
511 // optional. Called when all substitutions have been parsed
512 // `endResult` is the final value.
517 #### Plugin Transformers
519 You can wrap a transformer in a function that receives arguments in order to create a dynamic plugin:
522 const substitutionReplacer = (oldValue, newValue) => ({
523 onSubstitution(substitution, resultSoFar) {
524 if (substitution === oldValue) {
531 const replaceFizzWithBuzz = new TemplateTag(substitutionReplacer('fizz', 'buzz'))
533 replaceFizzWithBuzz`foo bar ${"fizz"}`
537 > **note** - if you call `new TemplateTag(substitutionReplacer)`, `substitutionReplacer` will automatically be initiated with no arguments.
541 You can pass a list of transformers, and `TemplateTag` will call them on your tag in the order they are specified:
544 // note: passing these as an array also works
545 const replace = new TemplateTag(
546 substitutionReplacer('fizz', 'buzz'),
547 substitutionReplacer('foo', 'bar')
550 replace`${"foo"} ${"fizz"}`
554 When multiple transformers are passed to `TemplateTag`, they will be iterated three times - first, all transformer `onString` methods will be called. Once they are done processing, `onSubstitution` methods will be called. Finally, all transformer `onEndResult` methods will be called.
556 #### Returning Other Values from a Transformer
558 This is super easy. Transformers are just objects, after all. They have full access to `this`:
563 this.ctx = this.ctx || { strings: [], subs: [] }
564 this.ctx.strings.push(str);
567 onSubstitution(sub, res) {
568 this.ctx.subs.push({ sub, precededBy: res })
578 return JSON.stringify(res, null, 2)
589 const process = new TemplateTag([listSubs, toJSON, log])
598 // "\n foo bar\n fizz ",
604 // "precededBy": "\n foo "
608 // "precededBy": "\n foo bar\n fizz "
614 #### List of Built-in Transformers
616 Since `common-tags` is built on the foundation of this TemplateTag class, it comes with its own set of built-in transformers:
618 ##### `trimResultTransformer([side])`
620 Trims the whitespace surrounding the end result. Accepts an optional `side` (can be `"start"` or `"end"` or alternatively `"left"` or `"right"`) that when supplied, will only trim whitespace from that side of the string.
622 ##### `stripIndentTransformer([type='initial'])`
624 Strips the indents from the end result. Offers two types: `all`, which removes all indentation from each line, and `initial`, which removes the shortest indent level from each line. Defaults to `initial`.
626 ##### `replaceResultTransformer(replaceWhat, replaceWith)`
628 Replaces a value or pattern in the end result with a new value. `replaceWhat` can be a string or a regular expression, `replaceWith` is the new value.
630 ##### `replaceSubstitutionTransformer(replaceWhat, replaceWith)`
632 Replaces the result of all substitutions (results of calling `${ ... }`) with a new value. Same as for `replaceResultTransformer`, `replaceWhat` can be a string or regular expression and `replaceWith` is the new value.
634 ##### `replaceStringTransformer(replaceWhat, replaceWith)`
636 Replaces the result of all strings (what's not in `${ ... }`) with a new value. Same as for `replaceResultTransformer`, `replaceWhat` can be a string or regular expression and `replaceWith` is the new value.
638 ##### `inlineArrayTransformer(opts)`
640 Converts any array substitutions into a string that represents a list. Accepts an options object:
644 separator: ',', // what to separate each item with (always followed by a space)
645 conjunction: 'and', // replace the last separator with this value
646 serial: true // should the separator be included before the conjunction? As in the case of serial/oxford commas
650 ##### `splitStringTransformer(splitBy)`
652 Splits a string substitution into an array by the provided `splitBy` substring, **only** if the string contains the `splitBy` substring.
656 Please see the [Contribution Guidelines](contributing.md).
660 MIT. See [license.md](license.md).
662 ## Other ES2015 Template Tag Modules
664 If `common-tags` doesn't quite fit your bill, and you just can't seem to find what you're looking for - perhaps these might be of use to you?
666 - [tage](https://www.npmjs.com/package/tage) - make functions work as template tags too
667 - [is-tagged](https://www.npmjs.com/package/is-tagged) - Check whether a function call is initiated by a tagged template string or invoked in a regular way
668 - [es6-template-strings](https://www.npmjs.com/package/es6-template-strings) - Compile and resolve template strings notation as specified in ES6
669 - [t7](https://github.com/trueadm/t7) - A light-weight virtual-dom template library
670 - [html-template-tag](https://www.npmjs.com/package/html-template-tag) - ES6 Tagged Template for compiling HTML template strings.
671 - [clean-tagged-string](https://www.npmjs.com/package/clean-tagged-string) - A simple utility function to clean ES6 template strings.
672 - [multiline-tag](https://www.npmjs.com/package/multiline-tag) - Tags for template strings making them behave like coffee multiline strings
673 - [deindent](https://www.npmjs.com/package/deindent) - ES6 template string helper for deindentation.
674 - [heredoc-tag](https://www.npmjs.com/package/heredoc-tag) - Heredoc helpers for ES2015 template strings
675 - [regx](https://www.npmjs.com/package/regx) - Tagged template string regular expression compiler.
676 - [regexr](https://www.npmjs.org/package/regexr) - Provides an ES6 template tag function that makes it easy to compose regexes out of template strings without double-escaped hell.
677 - [url-escape-tag](https://www.npmjs.com/package/url-escape-tag) - A template tag for escaping url parameters based on ES2015 tagged templates.
678 - [shell-escape-tag](https://www.npmjs.com/package/shell-escape-tag) - An ES6+ template tag which escapes parameters for interpolation into shell commands.
679 - [sql-tags](https://www.npmjs.com/package/sql-tags) - ES6 tagged template string functions for SQL statements.
680 - [sql-tag](https://www.npmjs.com/package/sql-tag) - A template tag for writing elegant sql strings.
681 - [sequelize-sql-tag](https://www.npmjs.com/package/sequelize-sql-tag) - A sequelize plugin for sql-tag
682 - [pg-sql-tag](https://www.npmjs.com/package/pg-sql-tag) - A pg plugin for sql-tag
683 - [sql-template-strings](https://www.npmjs.com/package/sql-template-strings) - ES6 tagged template strings for prepared statements with mysql and postgres
684 - [sql-composer](https://www.npmjs.com/package/sql-composer) - Composable SQL template strings for Node.js
685 - [pg-template-tag](https://www.npmjs.com/package/pg-template-tag) - ECMAScript 6 (2015) template tag function to write queries for node-postgres.
686 - [digraph-tag](https://www.npmjs.com/package/digraph-tag) - ES6 string template tag for quickly generating directed graph data
687 - [es2015-i18n-tag](https://www.npmjs.com/package/es2015-i18n-tag) - ES2015 template literal tag for i18n and l10n translation and localization