5af4780f9d43ff63c6340c29ae5033936cd29be0
[dotfiles/.git] / isOnlyWhitespace.js
1 /* @flow */
2 "use strict";
3
4 const isWhitespace = require("./isWhitespace");
5
6 /**
7  * Returns a Boolean indicating whether the the input string is only whitespace.
8  */
9 module.exports = function(input /*: string*/) /*: boolean*/ {
10   let isOnlyWhitespace = true;
11   for (let i = 0, l = input.length; i < l; i++) {
12     if (!isWhitespace(input[i])) {
13       isOnlyWhitespace = false;
14       break;
15     }
16   }
17   return isOnlyWhitespace;
18 };