Skip to content

Commit

Permalink
Added for Emoji🙃🙃 and Double Quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhav111tandon committed Feb 21, 2019
1 parent b9e0c2b commit d476b84
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# validity-checker
[![npm](https://img.shields.io/badge/npm-v2.2.2-blue.svg)](https://www.npmjs.com/package/validity-checker)
[![npm](https://img.shields.io/badge/npm-v2.2.3-blue.svg)](https://www.npmjs.com/package/validity-checker)

### Various types of functions to check the validity of various types of numbers and addresses.

Expand All @@ -25,6 +25,23 @@ var result = validityChecker.isMobileNumber("9999999999");
```
returns true or false

### 3. isBetweenDoubleQuotes()
```javascript
var result = validityChecker(isBetweenDoubleQuotes('Hello.. "Everybody"',"Everybody"));

/* returns true
checks according to the case sensitivity
*/
```

### 4. isEmoji()
```javascript
var result = validityChecker(isEmoji("🙃🙃"));
/* returns true */
```

#### Can be able to check following patterns
- (123) 456-7890
- (123)456-7890
Expand Down Expand Up @@ -59,6 +76,8 @@ returns true or false
**isMorseCode()** | Returns true if the entered string is a valid Morse Code or not
**isIPV4()** | Returns true if the entered string is a valid IPv4
**isIPV6()** | Returns true if the entered string is a valid IPv4
**isBetweenDoubleQuotes()** | Returns true if the entered string is contained in between double quotes
**isEmoji()** | Returns true if the entered string is an Emoji

## Note
The above mentioned functions validating only the format of the card numbers not the real card numbers.
Expand Down
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,23 @@ module.exports = {
}else{
return false;
}
},
isBetweenDoubleQuotes: function(text, betweenText){
var re = /"([^']*)"/;
var actualText = re.exec(text);
if(betweenText.equals(actualText[1])){
return true;
}else{
return false;
}
},
isEmoji: function(text){
var re = /^\p{Emoji}+$/u;
if(re.test(text)){
return true;
}else{
return false;
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "validity-checker",
"version": "2.2.2",
"version": "2.2.3",
"description": "Check the validity of various numbers",
"license": "MIT",
"repository": "vaibhav111tandon/validity-checker",
Expand Down

0 comments on commit d476b84

Please sign in to comment.