Closed JoshuaKGoldberg closed 1 year ago
Personally I would be considered about having different behaviour depending on how its called given you can do:
dedent(`my string`)
which cannot be detected as a template literal
Actually having thought about it a bit more, I think that default actually makes sense in reflection of the use-case:
dedent(cmsData.text
)
This pulls together #2, #26, #45, #46:
2: Backticks were confirmed as expected to be (un-)escaped properly when
dedent
is used with template literal strings.26: On the other hand, when
dedent
is used as a function, users aren't expecting that special character escapingI think the "right" (or: least unexpected) way would be to add an option with a not-very-savory name like
escapeSpecialCharacters
. The option would default to:true
when called for a template literal stringfalse
when called as a functionProposal:
Thoughts @G-Rath @sirian?