Skip to content

Commit

Permalink
Merge pull request #5 from lwinmoehein/development
Browse files Browse the repository at this point in the history
Add library version 2.0.0
  • Loading branch information
lwinmoehein authored Nov 7, 2023
2 parents fa58fea + 5e7d978 commit fcbe631
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- [License](#license)
## Features

- Check if a phone number is a valid local ( Myanmar ) phone number
- Check if a phone number is a valid Myanmar phone number
- Get the operator from a phone number

## Installing
Expand All @@ -31,6 +31,10 @@

Using npm:

```bash
$ npm install mm-mobile-tools
```

Once the package is installed, you can import the library using `import`:

```js
Expand All @@ -44,7 +48,7 @@ import mmphone from 'mm-mobile-tools';
```js
import mmphone from 'mm-mobile-tools';

console.log(mmphone.isValidPhone("09440813577"));
console.log(mmphone.isValid("09440813577"));
```
### Get operator

Expand Down
10 changes: 5 additions & 5 deletions __tests__/ValidatePhone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import mmphone from '../src/index';

describe('Phone Number validation checks', () => {
test('Should return true for valid MPT phone number', () => {
expect(mmphone.isValidPhone("09440813588")).toBe(true);
expect(mmphone.isValid("09440813588")).toBe(true);
});
test('Should return true for valid ATOM phone number', () => {
expect(mmphone.isValidPhone("09741173991")).toBe(true);
expect(mmphone.isValid("09741173991")).toBe(true);
});
test('Should return true for valid Ooredoo phone number', () => {
expect(mmphone.isValidPhone("09941173991")).toBe(true);
expect(mmphone.isValid("09941173991")).toBe(true);
});
test('Should return true for valid Mytel phone number', () => {
expect(mmphone.isValidPhone("09661173991")).toBe(true);
expect(mmphone.isValid("09661173991")).toBe(true);
});
test('Should return true for valid MECTel phone number', () => {
expect(mmphone.isValidPhone("09301173991")).toBe(true);
expect(mmphone.isValid("09301173991")).toBe(true);
});
});

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mm-mobile-tools",
"version": "1.0.0",
"version": "2.0.0",
"description": "A javascript library for working with myanmar phone numbers",
"main": "./lib/index.js",
"types":"./lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/MMPhone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function doesStringMatchAnyRegex(inputString: string, regexArray: RegExp[]): boo

export default class MMPhone {

isValidPhone(phoneNumber:string):boolean{
isValid(phoneNumber:string):boolean{
return this.getOperator(phoneNumber)!==Operator.INVALID;
}

Expand Down

0 comments on commit fcbe631

Please sign in to comment.