UNPKG

428 BJavaScriptView Raw
1'use strict';
2
3const isWhitespace = require('./isWhitespace');
4
5/**
6 * Returns a Boolean indicating whether the the input string is only whitespace.
7 *
8 * @param {string} input
9 * @returns {boolean}
10 */
11module.exports = function (input) {
12 let isOnlyWhitespace = true;
13
14 for (let i = 0, l = input.length; i < l; i++) {
15 if (!isWhitespace(input[i])) {
16 isOnlyWhitespace = false;
17 break;
18 }
19 }
20
21 return isOnlyWhitespace;
22};