Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77c3a9e commit e48f5e2Copy full SHA for e48f5e2
1 file changed
String/CheckPascalCase.js
@@ -0,0 +1,20 @@
1
+// CheckPascalCase method checks the given string is in PascalCase or not.
2
+
3
+// Problem Source & Explanation: https://www.theserverside.com/definition/Pascal-case
4
5
+/**
6
+ * CheckPascalCase method returns true if the string in PascalCase, else return the false.
7
+ * @param {String} VarName the name of the variable to check.
8
+ * @returns `Boolean` return true if the string is in PascalCase, else return false.
9
+ */
10
+const CheckPascalCase = (VarName) => {
11
+ // firstly, check that input is a string or not.
12
+ if (typeof VarName !== 'string') {
13
+ return 'Not string(s)'
14
+ }
15
16
+ const pat = /^[A-Z][A-Za-z]*$/
17
+ return pat.test(VarName)
18
+}
19
20
+module.exports = CheckPascalCase
0 commit comments