This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/is-word-character/index.js

15 lines
342 B
JavaScript

'use strict'
module.exports = wordCharacter
var fromCode = String.fromCharCode
var re = /\w/
// Check if the given character code, or the character code at the first
// character, is a word character.
function wordCharacter(character) {
return re.test(
typeof character === 'number' ? fromCode(character) : character.charAt(0)
)
}