You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stripIndent has apparently determined that the ident is "two whitespaces", and will consume such from the beginning of every line of the file - regardless of what kind of whitespace it is.
Almost certainly a very minor corner case, but it still seems incorrect?
The text was updated successfully, but these errors were encountered:
No, stripIndent doesn't care what combination of ' ', '\t', and '\r' is used - only how many whitespace characters there are. It's designed with the idea that for it to have any chance of working reasonably, the text has to be reasonably formatted. If a file does something like mix normal spaces and tabs, then there's pretty much no way that you're going to be able to cleanly strip whitespace. stripIndent could certainly be made to remember exactly what the whitespace was on the first line and only strip that, but I would expect it to be less efficient, and I seriously question that it would actually work well in the general case. If the text isn't cleanly formatted, then the best way to strip the whitespace is going to depend on exactly what was done with that particular document.
I don't know. I can see why someone might want to strip only a specific sequence of whitespace, but stripIndent is doing exactly what it was intended to do, and the assumption from the get-go was that a function like this was only going to have any chance of working if the document was well-formatted.
stripIndent(" foo\n\t\tbar")
Results in "foo\nbar"
stripIndent
has apparently determined that the ident is "two whitespaces", and will consume such from the beginning of every line of the file - regardless of what kind of whitespace it is.Almost certainly a very minor corner case, but it still seems incorrect?
The text was updated successfully, but these errors were encountered: