Slugify a string with comprehensive Unicode transliteration and extensive customization options
94
Create a command-line tool that processes a list of brand names and formats them for different contexts. The tool should handle case conversion, transliteration, and generate URL-friendly identifiers.
You will receive brand names that may contain:
Your tool must:
original: The original brand namelowercase: A lowercase ASCII version of the brand name (transliterated if needed)uppercase: An uppercase ASCII version of the brand name (transliterated if needed)slug: A URL-friendly slug version (lowercase, hyphen-separated)brands.json (an array of strings)formatted-brands.jsonbrands.json)[
"FooBar Technologies",
"Café München",
"北京科技",
"Mix3dCase"
]formatted-brands.json)[
{
"original": "FooBar Technologies",
"lowercase": "foobar technologies",
"uppercase": "FOOBAR TECHNOLOGIES",
"slug": "foobar-technologies"
},
{
"original": "Café München",
"lowercase": "cafe munchen",
"uppercase": "CAFE MUNCHEN",
"slug": "cafe-munchen"
},
{
"original": "北京科技",
"lowercase": "bei jing ke ji",
"uppercase": "BEI JING KE JI",
"slug": "bei-jing-ke-ji"
},
{
"original": "Mix3dCase",
"lowercase": "mix3dcase",
"uppercase": "MIX3DCASE",
"slug": "mix3dcase"
}
]Create a test file named formatter.test.js with the following test cases:
Input:
["Hello World", "TESTING"]Expected Output:
[
{
"original": "Hello World",
"lowercase": "hello world",
"uppercase": "HELLO WORLD",
"slug": "hello-world"
},
{
"original": "TESTING",
"lowercase": "testing",
"uppercase": "TESTING",
"slug": "testing"
}
]Input:
["Zürich", "Москва"]Expected Output:
[
{
"original": "Zürich",
"lowercase": "zurich",
"uppercase": "ZURICH",
"slug": "zurich"
},
{
"original": "Москва",
"lowercase": "moskva",
"uppercase": "MOSKVA",
"slug": "moskva"
}
]Input:
["iPhone", "macOS"]Expected Output:
[
{
"original": "iPhone",
"lowercase": "iphone",
"uppercase": "IPHONE",
"slug": "iphone"
},
{
"original": "macOS",
"lowercase": "macos",
"uppercase": "MACOS",
"slug": "macos"
}
]Provides string slugification and transliteration support.
Install with Tessl CLI
npx tessl i tessl/npm-sindresorhus--slugifydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10