isWhitespace.js 215 B

1234567891011
  1. 'use strict';
  2. /**
  3. * Check if a character is whitespace.
  4. *
  5. * @param {string} char
  6. * @returns {boolean}
  7. */
  8. module.exports = function isWhitespace(char) {
  9. return [' ', '\n', '\t', '\r', '\f'].includes(char);
  10. };