summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/is-whitespace-character/index.js
blob: 57d4ca68eb2e9bb8cf0195cb5bf1d6a09560c20c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

module.exports = whitespace;

var fromCode = String.fromCharCode;
var re = /\s/;

/* Check if the given character code, or the character
 * code at the first character, is a whitespace character. */
function whitespace(character) {
  return re.test(
    typeof character === 'number' ? fromCode(character) : character.charAt(0)
  );
}