zspecza / common-tags

🔖 Useful template literal tags for dealing with strings in ES2015+
Other
1.99k stars 61 forks source link

oneLineTrim does not trim lines if there is no leading space on a subsequent line. #110

Closed bsbates closed 6 years ago

bsbates commented 7 years ago

If I have a top level block of code that looks like this:

const myString = oneLineTrim`
hello
world
`

This will not properly combine the lines into a single line. If you look at the regex for oneLineTrim, it appears to need at least one space after the newline:

replaceResultTransformer(/(?:\n\s+)/g, '')
fatfisz commented 6 years ago

I can confirm that this is still happening. Will fix that soon, hopefully.