Adds utility to convert string to snake case
This commit is contained in:
parent
04f44155ab
commit
915a5a45e7
|
@ -0,0 +1,6 @@
|
|||
export const toSnakeCase = (str: string) => {
|
||||
return !str ? '' : String(str)
|
||||
.replace(/^\W+|\W+$/gi, '')
|
||||
.replace(/\W+/gi, '_')
|
||||
.toLowerCase();
|
||||
};
|
Loading…
Reference in New Issue