parse-phone
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -245,10 +245,6 @@ const dialingCodes = [ | ||
module.exports = (phoneStr) => { | ||
const data = {success: true} | ||
const matches = dialingCodes.filter(code=>phoneStr.startsWith(code)) | ||
if (matches.length == 0) return {success: false} | ||
data.dialCode = matches[0] | ||
data.full = phoneStr | ||
data.phone = phoneStr.replace(matches[0], '') | ||
return data | ||
return { success: true, dialCode: matches[0], full: phoneStr, phone: phoneStr.replace(matches[0], '') } | ||
} | ||
{ | ||
"name": "parse-phone", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "phone string parser", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"keywords": [ | ||
"international", | ||
"phone", | ||
@@ -28,0 +29,0 @@ "parse", |
@@ -7,3 +7,3 @@ # parse-phone | ||
phone parser for country dialing code parsing from full string | ||
phone parser for international dialing code parsing from full string | ||
@@ -26,2 +26,9 @@ ## Installation | ||
parsePhone('+18096958000') | ||
{ success: true, | ||
dialCode: '+1809', | ||
full: '+18096958000', | ||
phone: '6958000' } | ||
``` | ||
@@ -28,0 +35,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6671
44
267