Comment

Comment by swiftcoder

> 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...)

parent swiftcoder 1 month ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton