index.js 342 B

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