JSFiddle - React, Tailwind, and code Playground
JavaScript
function isNullOrWhitespace( input ) {
if (input == null) return true;
return input.replace(/\s/gi, '').length < 1;
}
/*alert (
'test: ' + isNullOrWhitespace ( 'test' ) + '\n' +
'null: ' + isNullOrWhitespace ( null ) + '\n' +
' 12 : ' + isNullOrWhitespace ( ' 12 ' ) + '\n' +
' : ' + isNullOrWhitespace ( ' ' ) + '\n'
);*/