diff --git a/README.md b/README.md index effe305..40efa5d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 diff --git a/__tests__/ValidatePhone.test.ts b/__tests__/ValidatePhone.test.ts index 289aca6..e53ed7e 100644 --- a/__tests__/ValidatePhone.test.ts +++ b/__tests__/ValidatePhone.test.ts @@ -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); }); }); diff --git a/package.json b/package.json index 223be51..28c4061 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/MMPhone.ts b/src/MMPhone.ts index b2795e3..9d8b57e 100644 --- a/src/MMPhone.ts +++ b/src/MMPhone.ts @@ -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; }