Slugify a string with comprehensive Unicode transliteration and extensive customization options
94
Build a utility that generates URL paths from article metadata using custom separator patterns for different content types.
Create a Node.js module that exports a function generateUrlPaths(articles) which takes an array of article objects and returns an array of URL path strings.
Each article object has the following properties:
title (string): The article titlecategory (string): The content category ('blog', 'docs', or 'news')The function should generate URL-friendly paths with category-specific separators:
__)--)::)The generated path format should be: category/slugified-title where the slugified title uses the appropriate multi-character separator for that category.
{title: "Hello World", category: "blog"}, it returns "blog/hello__world" @test{title: "API Reference", category: "docs"}, it returns "docs/api--reference" @test{title: "Breaking News", category: "news"}, it returns "news/breaking::news" @test@generates
/**
* Generates URL paths from article metadata with category-specific separators.
*
* @param {Array<{title: string, category: string}>} articles - Array of article objects
* @returns {string[]} Array of generated URL paths
*/
function generateUrlPaths(articles) {
// IMPLEMENTATION HERE
}
module.exports = { generateUrlPaths };Provides string slugification with customizable separators.
@satisfied-by
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