3 ms·
> Under a comment that reads // Workaround for trailing slashes, my code tacks an “a” onto the path so there’s always a last segment to cut off, then cuts it o
by swiftcoder 9d ago
> Under a comment that reads // Workaround for trailing slashes, my code tacks an “a” onto the path so there’s always a last segment to cut off, then cuts it off with a find-and-replace. When the path ends in a slash, that last segment is just the “a”, and the find-and-replace takes every other “a” in the path with it.
This is top-tier. left-pad levels of "we should just implement trivial functions in our own codebases"
(I do not mean that as a knock on the author - it solved his use case just fine. Everyone who took a dependency on it afterward though...)
- kstrauser 9d agoHeh, right? Author: Ugh, this is ugly, but it fixes the specific problem I’m having so I can go on and work on other things. Author, later: What do you mean, you’re all using this?
- jakeasmith 9d agohahaha yes, this exactly