Socket
Socket
Sign inDemoInstall

libphonenumber-js

Package Overview
Dependencies
Maintainers
1
Versions
392
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libphonenumber-js - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

15

build/metadata.js

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -99,7 +99,16 @@ Object.defineProperty(exports, "__esModule", {

function get_format_national_prefix_is_mandatory_when_formatting(format_array, country_metadata) {
var national_prefix_formatting_rule = get_format_national_prefix_formatting_rule(format_array, country_metadata);
// National prefix is omitted if there's no national prefix formatting rule
// set for this country, or when this rule is set but
// set for this country, or when the national prefix formatting rule
// contains no national prefix itself, or when this rule is set but
// national prefix is optional for this phone number format
// (and it is not enforced explicitly)
return get_format_national_prefix_formatting_rule(format_array, country_metadata) && !get_format_national_prefix_is_optional_when_formatting(format_array, country_metadata);
return national_prefix_formatting_rule &&
// Check that national prefix formatting rule is not a dummy one
national_prefix_formatting_rule !== '$1' &&
// Check that national prefix formatting rule actually has national prefix digit(s)
/\d/.test(national_prefix_formatting_rule.replace('$1', '')) &&
// Or maybe national prefix is optional for this format
!get_format_national_prefix_is_optional_when_formatting(format_array, country_metadata);
}

@@ -106,0 +115,0 @@

13

es6/metadata.js

@@ -66,7 +66,16 @@ export function get_phone_code(country_metadata) {

export function get_format_national_prefix_is_mandatory_when_formatting(format_array, country_metadata) {
var national_prefix_formatting_rule = get_format_national_prefix_formatting_rule(format_array, country_metadata);
// National prefix is omitted if there's no national prefix formatting rule
// set for this country, or when this rule is set but
// set for this country, or when the national prefix formatting rule
// contains no national prefix itself, or when this rule is set but
// national prefix is optional for this phone number format
// (and it is not enforced explicitly)
return get_format_national_prefix_formatting_rule(format_array, country_metadata) && !get_format_national_prefix_is_optional_when_formatting(format_array, country_metadata);
return national_prefix_formatting_rule &&
// Check that national prefix formatting rule is not a dummy one
national_prefix_formatting_rule !== '$1' &&
// Check that national prefix formatting rule actually has national prefix digit(s)
/\d/.test(national_prefix_formatting_rule.replace('$1', '')) &&
// Or maybe national prefix is optional for this format
!get_format_national_prefix_is_optional_when_formatting(format_array, country_metadata);
}

@@ -73,0 +82,0 @@

@@ -0,1 +1,6 @@

0.3.8 / 25.02.2016
===================
* Loosened national prefix requirement when parsing (fixed certain Brazilian phone numbers parsing)
0.3.6 / 16.02.2016

@@ -2,0 +7,0 @@ ===================

{
"name": "libphonenumber-js",
"version": "0.3.7",
"version": "0.3.8",
"description": "A simpler (and smaller) rewrite of Google Android's popular libphonenumber library",

@@ -5,0 +5,0 @@ "main": "index.common.js",

@@ -82,7 +82,15 @@ export function get_phone_code(country_metadata)

{
const national_prefix_formatting_rule = get_format_national_prefix_formatting_rule(format_array, country_metadata)
// National prefix is omitted if there's no national prefix formatting rule
// set for this country, or when this rule is set but
// set for this country, or when the national prefix formatting rule
// contains no national prefix itself, or when this rule is set but
// national prefix is optional for this phone number format
// (and it is not enforced explicitly)
return get_format_national_prefix_formatting_rule(format_array, country_metadata) &&
return national_prefix_formatting_rule &&
// Check that national prefix formatting rule is not a dummy one
national_prefix_formatting_rule !== '$1' &&
// Check that national prefix formatting rule actually has national prefix digit(s)
/\d/.test(national_prefix_formatting_rule.replace('$1', '')) &&
// Or maybe national prefix is optional for this format
!get_format_national_prefix_is_optional_when_formatting(format_array, country_metadata)

@@ -89,0 +97,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc