Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
is-alphanumerical
Advanced tools
The is-alphanumerical npm package is designed to check if a given input (string or character) is alphanumeric, meaning it consists of letters and numbers only. This can be particularly useful for validating user input, parsing content, or filtering data in applications where alphanumeric strings are required or expected.
Check if a string is alphanumeric
This feature allows you to verify if an entire string is alphanumeric. It returns true if the string contains only letters and numbers, and false otherwise.
"use strict"; var isAlphanumerical = require('is-alphanumerical'); console.log(isAlphanumerical('abc123')); // true console.log(isAlphanumerical('abc!123')); // false
Check if a single character is alphanumeric
This feature enables checking whether a single character is alphanumeric. It's useful for parsing or iterating through strings character by character to validate or process each one.
"use strict"; var isAlphanumerical = require('is-alphanumerical'); console.log(isAlphanumerical('a')); // true console.log(isAlphanumerical('!')); // false
Validator is a more comprehensive library for string validation and sanitization. It includes a function to check if a string is alphanumeric among many other validation functions. Compared to is-alphanumerical, validator is more versatile but also larger in size, making is-alphanumerical a lightweight alternative for specific alphanumeric checks.
Is-alphanumeric is another package with a similar purpose, offering functionality to check if strings or characters are alphanumeric. The main difference lies in the implementation details and possibly in performance benchmarks, but both serve the same primary purpose.
Check if a character is alphanumerical.
This is a function that checks if a given character is ASCII alphanumerical:
it matches [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-alphanumerical
In Deno with Skypack:
import {isAlphanumerical} from 'https://cdn.skypack.dev/is-alphanumerical@2?dts'
In browsers with Skypack:
<script type="module">
import {isAlphanumerical} from 'https://cdn.skypack.dev/is-alphanumerical@2?min'
</script>
import {isAlphanumerical} from 'is-alphanumerical'
isAlphanumerical('a') // => true
isAlphanumerical('Z') // => true
isAlphanumerical('0') // => true
isAlphanumerical(' ') // => false
isAlphanumerical('💩') // => false
This package exports the following identifier: isAlphanumerical
.
There is no default export.
isAlphanumerical(character)
Check whether the given character code (number
), or the character code at the
first position (string
), is alphanumerical.
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-decimal
wooorm/is-hexadecimal
wooorm/is-whitespace-character
wooorm/is-word-character
Yes please! See How to Contribute to Open Source.
FAQs
Check if a character is alphanumerical
The npm package is-alphanumerical receives a total of 5,677,702 weekly downloads. As such, is-alphanumerical popularity was classified as popular.
We found that is-alphanumerical 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.