I am currently working on a function that checks if a string is empty or not, but it seems to be missing the detection of new lines.
export const isStrEmpty = function(text: string): boolean {
return !text || text.match(/^ *$/) !== null;
};
I attempted to include \n
, but it did not have the desired effect.
export const isStrEmpty = function(text: string): boolean {
return !text || text.match(/^ *\n$/) !== null;
};
Is there a way I can modify this function to properly detect new lines within the string?