Skip to content

isBlank()

isBlank(input): boolean

Defined in: utils/string/isBlank.ts:16

Check whether a string is null, undefined, empty, or consists only of whitespace characters (as defined by String.prototype.trim).

Parameters

input

Value to check.

string | null | undefined

Returns

boolean

true if the string is effectively blank.

Example

ts
isBlank('');        // true
isBlank('   ');     // true
isBlank('\n\t');    // true
isBlank(' text ');  // false

Released under the MIT License.