tagged-template-noop
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Tagged template literal noop

npm

This module exports a single function that can be called with an ES2015 template string to have the same effect as not using any template function with your template literal.

const noopt = require('tagged-template-noop');
 
const qualifier = 'totally';
 
assert(
  noopt`Hopefully, I will be ${qualifier} useless.`
  ===  `Hopefully, I will be ${qualifier} useless.`
);

Possible uses include:

  • Expression-oriented programming style, e.g.:

    app.send((argv.escapeHtml ? escapeHtml : noopt)`
      <!doctype html>
      <html>
        <body>
          Hello ${form.username} !
        </body>
      </html>`
    );
  • Testing

  • Working around limited editor template literal content highlighting (e.g. to highlight GraphQL template strings in Vim)

Package Sidebar

Install

npm i tagged-template-noop

Weekly Downloads

4,807

Version

2.1.1

License

MIT

Unpacked Size

2.8 kB

Total Files

5

Last publish

Collaborators

  • lleaff