Repository: plexis-js/plexis (js)

Issue:
Feature request: `toPascalCase / classify`
Converts the input text to [pascal case](http://wiki.c2.com/?PascalCase).


**Example usage**

```javascript
import toPascalCase from '@plexis/to-pascal-case';

toPascalCase('Cool');
// => 'Cool'

toPascalCase('cool mate');
// => 'CoolMate'

toPascalCase('Hey how are you today?');
// => 'HeyHowAreYouToday'

toPascalCase('camelCase');
// => 'CamelCase'

toPascalCase('kebab-case');
// => KebabCase

```

**Aliases**

```javascript
import toPascalCase from '@plexis/to-pascal-case';
import {toPascalCase, classify} from 'plexis';
```

Pull request description:
feat(toPascalCase) Adds toPascalCase package to plexis
closes #16 

Patch:
diff --git a/packages/plexis/package.json b/packages/plexis/package.json
index 36331e3..93c7e51 100644
--- a/packages/plexis/package.json
+++ b/packages/plexis/package.json
@@ -21,6 +21,7 @@
     "@plexis/starts-with": "^0.0.15",
     "@plexis/to-chicago": "^0.0.15",
     "@plexis/to-lower": "^0.0.15",
+    "@plexis/to-pascal-case": "^0.0.15",
     "@plexis/to-pred": "^0.0.15",
     "@plexis/to-succ": "^0.0.15",
     "@plexis/to-title": "^0.0.15",
diff --git a/packages/plexis/src/index.js b/packages/plexis/src/index.js
index 802c19b..6a347be 100644
--- a/packages/plexis/src/index.js
+++ b/packages/plexis/src/index.js
@@ -27,3 +27,4 @@ export {
   default as levenshtein
 } from '@plexis/distance';
 export {default as isString} from '@plexis/is-string';
+export {default as toPascalCase, default as classify} from '@plexis/to-pascal-case';
diff --git a/packages/toPascalCase/README.md b/packages/toPascalCase/README.md
new file mode 100644
index 0000000..5c0ef24
--- /dev/null
+++ b/packages/toPascalCase/README.md
@@ -0,0 +1,33 @@
+## `toPascalCase`
+
+Converts the input text to pascal case
+
+`npm i @plexis/name-of-the-module`
+
+**Usage**
+
+```javascript
+import toPascalCase from '@plexis/to-pascal-case';
+
+toPascalCase('Cool');
+// => 'Cool'
+
+toPascalCase('cool mate');
+// => 'CoolMate'
+
+toPascalCase('Hey how are you today?');
+// => 'HeyHowAreYouToday'
+
+toPascalCase('camelCase');
+// => 'CamelCase'
+
+toPascalCase('kebab-case');
+// => KebabCase
+```
+
+**Aliases**
+
+```javascript
+import toPascalCase from '@plexis/to-pascal-case';
+import {toPascalCase, classify} from 'plexis';
+```
diff --git a/packages/toPascalCase/package.json b/packages/toPascalCase/package.json
new file mode 100644
index 0000000..9cdf5c2
--- /dev/null
+++ b/packages/toPascalCase/package.json
@@ -0,0 +1,29 @@
+{
+  "name": "@plexis/to-pascal-case",
+  "version": "0.0.15",
+  "main": "dist/index.js",
+  "module": "dist/index.esm.js",
+  "jsnext:main": "./src/index.js",
+  "files": [
+    "dist",
+    "src"
+  ],
+  "authors": [
+    "Jack Chapman <jackchapman093@gmail.com>"
+  ],
+  "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/toPascalCase/src/index.js b/packages/toPascalCase/src/index.js
new file mode 100644
index 0000000..b39780f
--- /dev/null
+++ b/packages/toPascalCase/src/index.js
@@ -0,0 +1,27 @@
+// to be replaced with @plexis/toCamelCase
+const toCamelCase = text => {
+  const lowerUpper = (letter, index) => {
+    return index === 0 ? letter.toLowerCase() : letter.toUpperCase();
+  };
+  const wordPatt = /^\w|[A-Z]|\b\w/g;
+  const symbolPatt = /[^a-zA-Z0-9]/g;
+  return text
+    .trim()
+    .replace(wordPatt, lowerUpper)
+    .replace(symbolPatt, '');
+};
+
+/**
+ * @description Convert a word to pascal case
+ * @param {String} text
+ * @example
+ * toPascalCase('foo') // returns 'Foo'
+ * toPred('foo bar') // returns 'FooBar'
+ * toPred('FOO BAR BAZ') // returns 'FooBarBaz'
+ */
+const toPascalCase = text => {
+  const result = toCamelCase(text);
+  return result.charAt(0).toUpperCase() + result.substr(1);
+};
+
+export default toPascalCase;


Test patch:
diff --git a/packages/plexis/test/__snapshots__/index.js.snap b/packages/plexis/test/__snapshots__/index.js.snap
index b101624..5cb47f0 100644
--- a/packages/plexis/test/__snapshots__/index.js.snap
+++ b/packages/plexis/test/__snapshots__/index.js.snap
@@ -30,5 +30,7 @@ Array [
   "calcLevenshtein",
   "levenshtein",
   "isString",
+  "toPascalCase",
+  "classify",
 ]
 `;
diff --git a/packages/toPascalCase/test/index.js b/packages/toPascalCase/test/index.js
new file mode 100644
index 0000000..0cb1c37
--- /dev/null
+++ b/packages/toPascalCase/test/index.js
@@ -0,0 +1,33 @@
+import toPascalCase from '../src';
+
+it('Works with single characters', () => {
+  expect(toPascalCase('h')).toBe('H');
+});
+
+it("Works will full words", () => {
+  expect(toPascalCase('hello')).toBe('Hello');
+});
+
+it('Works with strange cases on a single word', () => {
+  expect(toPascalCase('hEllO')).toBe('HEllO');
+});
+
+it('Works with multiple words', () => {
+  expect(toPascalCase('Hello there')).toBe('HelloThere');
+});
+
+it("Removes symbols", () => {
+  expect(toPascalCase('@@@hello@@@')).toBe('Hello');
+});
+
+it("Works with long strings", () => {
+  expect(toPascalCase('This is a long string compared to the other tests')).toBe('ThisIsALongStringComparedToTheOtherTests')
+})
+
+it("Converts camelCase properly", () => {
+  expect(toPascalCase('camelCase')).toBe('CamelCase');
+})
+
+it("Converts kebab-case properly", () => {
+  expect(toPascalCase('kebab-case')).toBe('KebabCase');
+})
\ No newline at end of file