Multiline template strings that don't break indentation

Marius Gundersen gundersen at
Fri Sep 12 00:04:04 PDT 2014

On Fri, Sep 12, 2014 at 7:40 AM, Sebastian Zartner <
sebastianzartner at> wrote:

> And if someone wants to use his own tag? Would he have to reimplement
> dontIndent or String.noIndentation by himself?
> What I meant above with tag concatenation would be something like this:
>         var a = String.noIndentation myTag
>                 `This is a template string.
>                  Even though each line is indented to keep the
>                  code neat and tidy, the white space used to indent
>                  is not in the resulting string`;
> So first the template string would be parsed by String.noIndentation and
> subsequently by myTag.

String.noIndent could return an array similar to what a tag function
expects to get as its arguments, where the first item is the string split
into chunks and the rest of the array is the values to be inserted. That
would let you do:

var query = sql(...String.noIndent`
    select * from myDB
    where username='${user}'
    and password='${password}'

Marius Gundersen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list