Wednesday, 28 August 2013

isBlank()

Another brilliant little bit of code to complement empty() is isBlank():

function isBlank(str) {
    return (!str || /^\s*$/.test(str));
}