They call me Stacy
I could only imagine what the default:'friend' actually is on the backend.
Syndicated from the fediverse. Read and engage on the original instance.
View original on lemmy.worldI could only imagine what the default:'friend' actually is on the backend.
13 replies
There is no
default:’friend’on the backend. This is a template language that basically takes a first name, returns the first word, replaces any special characters with ASCII equivalent ones (e.g., ö => o), title cases it, and if it’s blank it will return ‘friend’ instead of an empty string.🍻
Seems so. But a
}is missing, which is why it's showing like that.Oops, someone forgot a curly brace!
Hey, { first_name|truncatewords: 1|slugify|title| default:'friend' } was my father, call me Mike!
What the heck is slugify
This is my best guess. I have never used it. NPM and JS are not fun for me. Like look at those dependencies.
Hmm, I see zero direct dependencies in that npm page. Were you looking at dependants? Packages that need the slug package?
Awh shit, well I can't read. Which is also why I dont use JS or NPM.
I'm really learning a lot by posting this! Thats interesting for sure. I think I'm just more than happy my own career never involves me in this side of tech lol
that format would mangle so many names. my legal name is my middle name, so it would fail. my grandfather's first name was Jan Erik (with a space, it's still a single name), it would fail on that. i know a guy named Göran, it would fail on that (ö is not an accented o, it is a separate letter, but it will slugify to o due to browsers being browsers).
actually, come to think of it, wouldn't this also mangle the default due to 'friend' not being properly capitalized?
basically, we've learned nothing since 'falsehoods programmers believe about names'. that was 14 years ago.