react-simple-phone-input 1.0.7-beta → 1.0.8-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/index.js.map +1 -1
- package/package.json +6 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3990,12 +3990,12 @@ const getDefaultCountry = (code) => {
|
|
|
3990
3990
|
return result;
|
|
3991
3991
|
};
|
|
3992
3992
|
const getBySearch = (search, onlyCountry, excludeCountry) => {
|
|
3993
|
-
|
|
3993
|
+
var countries = [];
|
|
3994
3994
|
if (excludeCountry && excludeCountry.length > 0) {
|
|
3995
|
-
countries = countryData.filter((item) =>
|
|
3995
|
+
countries = countryData.filter((item) => (excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.indexOf(item.countryCode)) === -1);
|
|
3996
3996
|
}
|
|
3997
3997
|
else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
|
|
3998
|
-
countries = countryData.filter((item) => onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.
|
|
3998
|
+
countries = countryData.filter((item) => (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.indexOf(item.countryCode)) !== -1);
|
|
3999
3999
|
}
|
|
4000
4000
|
else {
|
|
4001
4001
|
countries = countryData;
|
|
@@ -4008,17 +4008,17 @@ const getBySearch = (search, onlyCountry, excludeCountry) => {
|
|
|
4008
4008
|
return result;
|
|
4009
4009
|
};
|
|
4010
4010
|
const getCountryByFilter = (onlyCountry, excludeCountry, preferredCountry) => {
|
|
4011
|
-
|
|
4011
|
+
var countries = [];
|
|
4012
4012
|
if (excludeCountry && excludeCountry.length > 0) {
|
|
4013
|
-
countries = countryData.filter((item) =>
|
|
4013
|
+
countries = countryData.filter((item) => (excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.indexOf(item.countryCode)) === -1);
|
|
4014
4014
|
}
|
|
4015
4015
|
else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
|
|
4016
|
-
countries = countryData.filter((item) => onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.
|
|
4016
|
+
countries = countryData.filter((item) => (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.indexOf(item.countryCode)) !== -1);
|
|
4017
4017
|
}
|
|
4018
4018
|
else {
|
|
4019
4019
|
countries = countryData;
|
|
4020
4020
|
}
|
|
4021
|
-
const result = countries.sort((a, b) => (Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.
|
|
4021
|
+
const result = countries.sort((a, b) => (Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(b.countryCode)) - Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(a.countryCode)))
|
|
4022
4022
|
|| ((preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(a.countryCode)) - (preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(b.countryCode))));
|
|
4023
4023
|
return result;
|
|
4024
4024
|
};
|