Multiline template strings that don't break indentation

Kevin Smith zenparsing at gmail.com
Tue Sep 9 08:44:37 PDT 2014


You can create a really flexible "dedent" function/tag pretty easily:

https://gist.github.com/zenparsing/5dffde82d9acef19e43c

Nice, right?

On Tue, Sep 9, 2014 at 10:51 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

> Well, just for fun
>
>         const N = "\n";  //maybe we could find evocative unicode name.
>         var a = `This is a template string. ${
>                N}Even though each line is indented to keep the ${
>                N}code neat and tidy, the white space used to indent ${
>                N}is not in the resulting string`;
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140909/698d68e5/attachment-0001.html>


More information about the es-discuss mailing list