This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateSafeSlugString = (s) => s?.toString().normalize('NFD').replace(/[\u0300-\u036f]/g, "") //remove diacritics | |
.toLowerCase() | |
.replace(/\s+/g, '-') //spaces to dashes | |
.replace(/&/g, '-and-') //ampersand to and | |
.replace(/[^\w\-]+/g, '') //remove non-words | |
.replace(/\-\-+/g, '-') //collapse multiple dashes | |
.replace(/^-+/, '') //trim starting dash | |
.replace(/-+$/, ''); //trim ending dash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @experimentalDecorators | |
console.clear(); | |
function computeFullName() { | |
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { | |
// target is the class name | |
// propertyKey is the method name in the class | |
// This is the method func itself |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://kentcdodds.com/blog/use-ternaries-rather-than-and-and-in-jsx |