Repository: plexis-js/plexis (js)

Issue:
Feature request: `isAlphaDigit`
Checks whether the input text contains only alpha and digit characters.

**Example usage**

```javascript
import isAlphaDigit from '@plexis/is-alphadigit';

isAlphaDigit('ABCD');
// => true

isAlphaDigit('Apollo11');
// => true

isEmpty('Hello world');
// => false

isEmpty('Hello,world');
// => false

isAlphaDigit('');
// => false

isEmpty('   ');
// => false
```

**Aliases**

```javascript
import isAlphaDigit from '@plexis/is-alphadigit';
import {isAlphaDigit} from 'plexis';
```

Pull request description:
feat: isAlphaNumeric
Added the isAlphaNumeric feature to check for strings that consist of alphabetical and/or numerical characters.  
Aliases are `isAlphaNumeric`, `isAlphanumeric` and `isAlphaDigit`

Closes #20 

Patch:
diff --git a/docs/pages/api.md b/docs/pages/api.md
index 6667008..d8497a1 100644
--- a/docs/pages/api.md
+++ b/docs/pages/api.md
@@ -5,6 +5,7 @@
 - [distance](/packages/distance)
 - [escapeHTML](/packages/escapeHTML)
 - [isAlpha](/packages/isAlpha)
+- [isAlphaNumeric](/packages/isAlphaNumeric)
 - [isLowerCase](/packages/isLowerCase)
 - [isNumeric](/packages/isNumeric)
 - [isString](/packages/isString)
diff --git a/packages/isAlphaNumeric/.npmignore b/packages/isAlphaNumeric/.npmignore
new file mode 100644
index 0000000..552cf85
--- /dev/null
+++ b/packages/isAlphaNumeric/.npmignore
@@ -0,0 +1,17 @@
+.DS_Store
+*.test.js
+.prettierrc
+.github
+.template
+.package-template
+.nyc_output
+.circleci
+.commitlintrc.js
+coverage
+coverage.lcov
+docs
+babel.config.js
+test
+CONTRIBUTING.md
+CODE_OF_CONDUCT.md
+LICENCE
\ No newline at end of file
diff --git a/packages/isAlphaNumeric/README.md b/packages/isAlphaNumeric/README.md
new file mode 100644
index 0000000..4e52460
--- /dev/null
+++ b/packages/isAlphaNumeric/README.md
@@ -0,0 +1,23 @@
+## `isAlphaNumeric`
+
+Checks whether the input is a string containing only alphanumeric characters.
+
+`npm i @plexis/is-alphanumeric`
+
+**Usage**
+
+```javascript
+import isAlphaNumeric from '@plexis/is-alphanumeric';
+
+isAlphaNumeric('foo123BAR'); // returns true
+isAlphaNumeric('1.0'); // returns false
+isAlphaNumeric('bar!'); // returns false
+isAlphaNumeric(''); // returns false
+```
+
+**Aliases**
+
+```javascript
+import isAlphaNumeric from '@plexis/is-alphanumeric';
+import {isAlphaNumeric, isAlphanumeric, isAlphaDigit} from 'plexis';
+```
diff --git a/packages/isAlphaNumeric/package.json b/packages/isAlphaNumeric/package.json
new file mode 100644
index 0000000..8dccdd0
--- /dev/null
+++ b/packages/isAlphaNumeric/package.json
@@ -0,0 +1,22 @@
+{
+  "name": "@plexis/is-alphanumeric",
+  "version": "0.0.21",
+  "main": "dist/index.js",
+  "module": "dist/index.esm.js",
+  "jsnext:main": "./src/index.js",
+  "license": "MIT",
+  "keywords": [
+    "utility",
+    "string",
+    "parse",
+    "format",
+    "validate"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/plexis-js/plexis.git"
+  },
+  "publishConfig": {
+    "access": "public"
+  }
+}
\ No newline at end of file
diff --git a/packages/isAlphaNumeric/src/index.js b/packages/isAlphaNumeric/src/index.js
new file mode 100644
index 0000000..1954ba4
--- /dev/null
+++ b/packages/isAlphaNumeric/src/index.js
@@ -0,0 +1,14 @@
+/**
+ * @description Checks whether the input is a string containing only alphanumeric characters
+ * @param {String} text
+ * @example
+ * isAlphaNumeric('fooBAR') // returns true
+ * isAlphaNumeric('123') // returns true
+ * isAlphaNumeric('foo123BAR') // returns true
+ * isAlphaNumeric('1.0') // returns false
+ * isAlphaNumeric('bar!') // returns false
+ * isAlphaNumeric('') // returns false
+ */
+const isAlphaNumeric = text => typeof text === 'string' ? /^[A-Za-z0-9]+$/.test(text) : false;
+
+export default isAlphaNumeric;
diff --git a/packages/plexis/package.json b/packages/plexis/package.json
index ffe2dfc..e0887af 100644
--- a/packages/plexis/package.json
+++ b/packages/plexis/package.json
@@ -17,6 +17,7 @@
     "@plexis/distance": "^0.0.21",
     "@plexis/escape-html": "^0.0.21",
     "@plexis/is-alpha": "^0.0.21",
+    "@plexis/is-alphanumeric": "^0.0.21",
     "@plexis/is-lowercase": "^0.0.21",
     "@plexis/is-numeric": "^0.0.21",
     "@plexis/is-string": "^0.0.21",
diff --git a/packages/plexis/src/index.js b/packages/plexis/src/index.js
index 7f64fbd..042f0e2 100644
--- a/packages/plexis/src/index.js
+++ b/packages/plexis/src/index.js
@@ -46,3 +46,8 @@ export {
   default as removeIndent,
   default as withoutIndent
 } from '@plexis/without-indent';
+export {
+  default as isAlphaNumeric,
+  default as isAlphanumeric,
+  default as isAlphaDigit
+} from '@plexis/is-alphanumeric';


Test patch:
diff --git a/packages/isAlphaNumeric/test/index.js b/packages/isAlphaNumeric/test/index.js
new file mode 100644
index 0000000..95802be
--- /dev/null
+++ b/packages/isAlphaNumeric/test/index.js
@@ -0,0 +1,41 @@
+import isAlphaNumeric from '../src';
+
+it('should return true for a string of alphabetical characters (upper- and lower-case)', () => {
+  expect(isAlphaNumeric('fooBAR')).toBe(true);
+});
+
+it('should return true for a string of numeric characters', () => {
+  expect(isAlphaNumeric('123')).toBe(true);
+});
+
+it('should return true for a string of alphabetical and numeric characters', () => {
+  expect(isAlphaNumeric('fooBAR123')).toBe(true);
+});
+
+it('should return false for strings with non-numeric characters', () => {
+  expect(isAlphaNumeric('!')).toBe(false);
+  expect(isAlphaNumeric('@')).toBe(false);
+  expect(isAlphaNumeric('.')).toBe(false);
+  expect(isAlphaNumeric(' ')).toBe(false);
+  expect(isAlphaNumeric('-')).toBe(false);
+  expect(isAlphaNumeric('_')).toBe(false);
+  expect(isAlphaNumeric('=')).toBe(false);
+  expect(isAlphaNumeric('+')).toBe(false);
+  expect(isAlphaNumeric('(')).toBe(false);
+  expect(isAlphaNumeric('^')).toBe(false);
+  expect(isAlphaNumeric('ä')).toBe(false);
+});
+
+it('should return false for an empty string', () => {
+  expect(isAlphaNumeric('')).toBe(false);
+});
+
+it('should return false for inputs that are not strings', () => {
+  expect(isAlphaNumeric(0)).toBe(false);
+  expect(isAlphaNumeric(1.5)).toBe(false);
+  expect(isAlphaNumeric(true)).toBe(false);
+  expect(isAlphaNumeric(null)).toBe(false);
+  expect(isAlphaNumeric(undefined)).toBe(false);
+  expect(isAlphaNumeric({foo: 'bar'})).toBe(false);
+  expect(isAlphaNumeric(['foo', 'bar'])).toBe(false);
+});
diff --git a/packages/plexis/test/__snapshots__/index.js.snap b/packages/plexis/test/__snapshots__/index.js.snap
index 2aad53d..6239750 100644
--- a/packages/plexis/test/__snapshots__/index.js.snap
+++ b/packages/plexis/test/__snapshots__/index.js.snap
@@ -50,5 +50,8 @@ Array [
   "dedent",
   "removeIndent",
   "withoutIndent",
+  "isAlphaNumeric",
+  "isAlphanumeric",
+  "isAlphaDigit",
 ]
 `;