dedent-js icon indicating copy to clipboard operation
dedent-js copied to clipboard

Bug with escaped newlines

Open sirian opened this issue 6 years ago • 2 comments

dedent`foo\n    bar`

is not the same as

dedent`foo
    bar`

But both produces "foo\nbar"

dedent`foo\n    bar` should be "foo\n    bar"

sirian avatar Dec 26 '18 14:12 sirian

This is in line with the test suite and readme. IIRC it wasn't possible to detect the difference. You can write it like this though:

dedent`
    foo
        bar
`

MartinKolarik avatar Dec 28 '18 13:12 MartinKolarik

it's possible to detect via raw value of template strings

image

sirian avatar Dec 28 '18 14:12 sirian