libphonenumber-js
Advanced tools
Comparing version 1.10.9 to 1.10.10
@@ -159,3 +159,3 @@ "use strict"; | ||
}, | ||
onCallingCodeChange: function onCallingCodeChange(country, callingCode) { | ||
onCallingCodeChange: function onCallingCodeChange(callingCode, country) { | ||
_this.metadata.selectNumberingPlan(country, callingCode); | ||
@@ -162,0 +162,0 @@ |
@@ -1242,2 +1242,8 @@ "use strict"; | ||
}); | ||
it('should work for SK phone numbers (2)', function () { | ||
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/69 | ||
var formatter = new AsYouType('SK'); | ||
formatter.input('421901222333').should.equal('421 901 222 333'); | ||
formatter.getTemplate().should.equal('xxx xxx xxx xxx'); | ||
}); | ||
}); | ||
@@ -1244,0 +1250,0 @@ |
@@ -390,3 +390,6 @@ "use strict"; | ||
}); | ||
this.startInternationalNumber(state); | ||
this.startInternationalNumber(state, { | ||
country: undefined, | ||
callingCode: undefined | ||
}); | ||
return true; | ||
@@ -407,3 +410,6 @@ } | ||
}); | ||
this.startInternationalNumber(state); | ||
this.startInternationalNumber(state, { | ||
country: state.country, | ||
callingCode: newCallingCode | ||
}); | ||
return true; | ||
@@ -415,4 +421,6 @@ } | ||
key: "startInternationalNumber", | ||
value: function startInternationalNumber(state) { | ||
state.startInternationalNumber(); // If a national (significant) number has been extracted before, reset it. | ||
value: function startInternationalNumber(state, _ref3) { | ||
var country = _ref3.country, | ||
callingCode = _ref3.callingCode; | ||
state.startInternationalNumber(country, callingCode); // If a national (significant) number has been extracted before, reset it. | ||
@@ -419,0 +427,0 @@ if (state.nationalSignificantNumber) { |
@@ -69,7 +69,7 @@ "use strict"; | ||
this.callingCode = callingCode; | ||
return this.onCallingCodeChange(this.country, callingCode); | ||
this.onCallingCodeChange(callingCode, this.country); | ||
} | ||
}, { | ||
key: "startInternationalNumber", | ||
value: function startInternationalNumber() { | ||
value: function startInternationalNumber(country, callingCode) { | ||
// Prepend the `+` to parsed input. | ||
@@ -80,3 +80,3 @@ this.international = true; // If a default country was set then reset it | ||
this.initCountryAndCallingCode(); | ||
this.initCountryAndCallingCode(country, callingCode); | ||
} | ||
@@ -83,0 +83,0 @@ }, { |
@@ -140,3 +140,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
}, | ||
onCallingCodeChange: function onCallingCodeChange(country, callingCode) { | ||
onCallingCodeChange: function onCallingCodeChange(callingCode, country) { | ||
_this.metadata.selectNumberingPlan(country, callingCode); | ||
@@ -143,0 +143,0 @@ |
@@ -1237,2 +1237,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
}); | ||
it('should work for SK phone numbers (2)', function () { | ||
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/69 | ||
var formatter = new AsYouType('SK'); | ||
formatter.input('421901222333').should.equal('421 901 222 333'); | ||
formatter.getTemplate().should.equal('xxx xxx xxx xxx'); | ||
}); | ||
}); | ||
@@ -1239,0 +1245,0 @@ |
@@ -374,3 +374,6 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
}); | ||
this.startInternationalNumber(state); | ||
this.startInternationalNumber(state, { | ||
country: undefined, | ||
callingCode: undefined | ||
}); | ||
return true; | ||
@@ -391,3 +394,6 @@ } | ||
}); | ||
this.startInternationalNumber(state); | ||
this.startInternationalNumber(state, { | ||
country: state.country, | ||
callingCode: newCallingCode | ||
}); | ||
return true; | ||
@@ -399,4 +405,6 @@ } | ||
key: "startInternationalNumber", | ||
value: function startInternationalNumber(state) { | ||
state.startInternationalNumber(); // If a national (significant) number has been extracted before, reset it. | ||
value: function startInternationalNumber(state, _ref3) { | ||
var country = _ref3.country, | ||
callingCode = _ref3.callingCode; | ||
state.startInternationalNumber(country, callingCode); // If a national (significant) number has been extracted before, reset it. | ||
@@ -403,0 +411,0 @@ if (state.nationalSignificantNumber) { |
@@ -62,7 +62,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
this.callingCode = callingCode; | ||
return this.onCallingCodeChange(this.country, callingCode); | ||
this.onCallingCodeChange(callingCode, this.country); | ||
} | ||
}, { | ||
key: "startInternationalNumber", | ||
value: function startInternationalNumber() { | ||
value: function startInternationalNumber(country, callingCode) { | ||
// Prepend the `+` to parsed input. | ||
@@ -73,3 +73,3 @@ this.international = true; // If a default country was set then reset it | ||
this.initCountryAndCallingCode(); | ||
this.initCountryAndCallingCode(country, callingCode); | ||
} | ||
@@ -76,0 +76,0 @@ }, { |
{ | ||
"name": "libphonenumber-js", | ||
"version": "1.10.9", | ||
"version": "1.10.10", | ||
"description": "A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs", |
@@ -100,3 +100,3 @@ import Metadata from './metadata.js' | ||
}, | ||
onCallingCodeChange: (country, callingCode) => { | ||
onCallingCodeChange: (callingCode, country) => { | ||
this.metadata.selectNumberingPlan(country, callingCode) | ||
@@ -103,0 +103,0 @@ this.formatter.reset(this.metadata.numberingPlan, this.state) |
@@ -1359,2 +1359,9 @@ import metadata from '../metadata.min.json' | ||
}) | ||
it('should work for SK phone numbers (2)', function() { | ||
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/69 | ||
const formatter = new AsYouType('SK') | ||
formatter.input('421901222333').should.equal('421 901 222 333') | ||
formatter.getTemplate().should.equal('xxx xxx xxx xxx') | ||
}) | ||
}) | ||
@@ -1361,0 +1368,0 @@ |
@@ -388,3 +388,6 @@ import extractCountryCallingCode from './helpers/extractCountryCallingCode.js' | ||
}) | ||
this.startInternationalNumber(state) | ||
this.startInternationalNumber(state, { | ||
country: undefined, | ||
callingCode: undefined | ||
}) | ||
return true | ||
@@ -409,3 +412,6 @@ } | ||
}) | ||
this.startInternationalNumber(state) | ||
this.startInternationalNumber(state, { | ||
country: state.country, | ||
callingCode: newCallingCode | ||
}) | ||
return true | ||
@@ -416,4 +422,4 @@ } | ||
startInternationalNumber(state) { | ||
state.startInternationalNumber() | ||
startInternationalNumber(state, { country, callingCode }) { | ||
state.startInternationalNumber(country, callingCode) | ||
// If a national (significant) number has been extracted before, reset it. | ||
@@ -420,0 +426,0 @@ if (state.nationalSignificantNumber) { |
@@ -43,6 +43,6 @@ export default class AsYouTypeState { | ||
this.callingCode = callingCode | ||
return this.onCallingCodeChange(this.country, callingCode) | ||
this.onCallingCodeChange(callingCode, this.country) | ||
} | ||
startInternationalNumber() { | ||
startInternationalNumber(country, callingCode) { | ||
// Prepend the `+` to parsed input. | ||
@@ -53,3 +53,3 @@ this.international = true | ||
// number is being entered. | ||
this.initCountryAndCallingCode() | ||
this.initCountryAndCallingCode(country, callingCode) | ||
} | ||
@@ -56,0 +56,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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 too big to display
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
7561370
37062