Slugify a string with comprehensive Unicode transliteration and extensive customization options
94
Build a utility that converts programming identifiers (variable names, class names, function names) into URL-friendly slugs for use in documentation sites.
Your solution should handle the following conversions:
fooBar to foo-bar @testUserProfile to user-profile @testFOO360BAR to foo-360-bar @testAPISection to api-section @testXMLHttpRequest to xml-http-request @testfoo to foo @testAPI to api @testCreate a function convertIdentifierToSlug that takes a string (programming identifier) and returns a URL-friendly slug string.
@generates
/**
* Converts a programming identifier to a URL-friendly slug
*
* @param {string} identifier - The programming identifier to convert
* @returns {string} The URL-friendly slug
*/
function convertIdentifierToSlug(identifier) {
// IMPLEMENTATION HERE
}
module.exports = { convertIdentifierToSlug };Provides string slugification 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