• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2
3module.exports = wordCharacter
4
5var fromCode = String.fromCharCode
6var re = /\w/
7
8// Check if the given character code, or the character code at the first
9// character, is a word character.
10function wordCharacter(character) {
11  return re.test(
12    typeof character === 'number' ? fromCode(character) : character.charAt(0)
13  )
14}
15