Common-tags

common-tags

Common utility template tags for ES2015

🔖 A set of well-tested, commonly used template literal tag functions for use in ES2015+.

🌟 Plus some extra goodies for easily making your own tags.

Provides the below almost self explanatory functions:

  • TemplateTag
  • codeBlock
  • commaLists
  • commaListsAnd
  • commaListsOr
  • html
  • inlineArrayTransformer
  • inlineLists
  • oneLine
  • oneLineCommaLists
  • oneLineCommaListsAnd
  • oneLineCommaListsOr
  • oneLineInlineLists
  • oneLineTrim
  • removeNonPrintingValuesTransformer
  • replaceResultTransformer
  • replaceSubstitutionTransformer
  • safeHtml
  • source
  • splitStringTransformer
  • stripIndent
  • stripIndentTransformer
  • stripIndents
  • trimResultTransformer

GET IT: npm install --save common-tags

Sample usage:

1
2
3
4
5
6
7
8
import {oneLine} from 'common-tags'

oneLine`
  foo
  bar
  baz
`)
// "foo bar baz" 

GIF FTW:

common-tags

Suggest a module

Comments