On Fri, Sep 12, 2014 at 7:40 AM, Sebastian Zartner <
[email protected]> 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:
```js
var query = sql(...String.noIndent`
select * from myDB
where username='${user}'
and password='${password}'
`);
```
Marius Gundersen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss