diff --git a/dist/index.js b/dist/index.js index 2a9c6e7..c1355db 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.formatPhone = formatPhone; exports.checkOperator = checkOperator; +exports.isValid = isValid; function formatPhone(phone) { const phone_length = phone === null || phone === void 0 ? void 0 : phone.toString().length; if (phone_length === 13 && phone.startsWith("+251")) { @@ -17,7 +18,7 @@ function formatPhone(phone) { return `+251${phone}`; } else { - return "INVALID PHONE NUMBER"; + return "INVALID_PHONE_NUMBER"; } } function checkOperator(phone) { @@ -32,3 +33,7 @@ function checkOperator(phone) { return "UNKNOWN"; } } +function isValid(phone) { + const formattedPhone = formatPhone(phone); + return formattedPhone === "INVALID_PHONE_NUMBER" ? false : true; +} diff --git a/package.json b/package.json index 4aa91a1..fd23cda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phone-formatter-eth", - "version": "1.1.5", + "version": "1.1.6", "description": "Format Ethiopian phone numbers and check ISP under the number.", "main": "dist/index.js", "types": "dist/index.d.ts",