Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
is-word-character
Advanced tools
Readme
Check if a character is a word character.
This is a function that checks if a given character is a word character:
whether it matches \w
(which is short for [a-zA-Z0-9_]
).
Not often, as it’s relatively simple to do yourself. This package exists because it’s needed in several related packages, at which point it becomes useful to defer to one shared function.
This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:
npm install is-word-character
In Deno with Skypack:
import {isWordCharacter} from 'https://cdn.skypack.dev/is-word-character@2?dts'
In browsers with Skypack:
<script type="module">
import {isWordCharacter} from 'https://cdn.skypack.dev/is-word-character@2?min'
</script>
import {isWordCharacter} from 'is-word-character'
isWordCharacter('a') // => true
isWordCharacter('Z') // => true
isWordCharacter('0') // => true
isWordCharacter('_') // => true
isWordCharacter(' ') // => false
isWordCharacter('💩') // => false
This package exports the following identifier: isWordCharacter
.
There is no default export.
isWordCharacter(character|code)
Check whether the given character code (number
), or the character code at the
first position (string
), is a word character.
This package is fully typed with TypeScript.
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.
This package is safe.
wooorm/is-alphabetical
wooorm/is-alphanumerical
wooorm/is-decimal
wooorm/is-hexadecimal
wooorm/is-whitespace-character
Yes please! See How to Contribute to Open Source.
FAQs
Check if a character is a word character
The npm package is-word-character receives a total of 2,199,256 weekly downloads. As such, is-word-character popularity was classified as popular.
We found that is-word-character demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.