Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const title_to_text_id = (title): string => {
- return title.toString().toLowerCase()
- .replace(/\s+/g, '_') // Replace spaces with _
- .replace(/[^\w\-]+/g, '') // Remove all non-word chars
- .replace(/\-+/g, '') // Replace multiple - with single _
- .replace(/^_+/, '') // Trim - from start of text
- .replace(/_+$/, '');
- }
Add Comment
Please, Sign In to add comment