Currently I have a function that checks if a string is empty or not, but it does not detects if I there is a new line
export const isStrEmpty = function(text: string): boolean {
return !text || text.match(/^ *$/) !== null;
};
I tried adding \n
, it doesn't work
export const isStrEmpty = function(text: string): boolean {
return !text || text.match(/^ *\n$/) !== null;
};
Is there a way I can make this function detects if there is a new line in the string?