country-codes-list
Advanced tools
Comparing version 1.4.0 to 1.5.1
@@ -39,3 +39,3 @@ const groupBy = require('./utils/groupBy') | ||
*/ | ||
customArray: function (fields = { name: '{countryNameEn} ({countryCode})', value: '{countryCode}'}, { sortBy = 'name', filter } = {}) { | ||
customArray: function (fields = { name: '{countryNameEn} ({countryCode})', value: '{countryCode}'}, { sortBy = 'name', sortDataBy, filter } = {}) { | ||
const finalCollection = [] | ||
@@ -48,2 +48,8 @@ | ||
if (sortDataBy && fields[sortDataBy]) { | ||
// ignore upper and lowercase | ||
const collator = new Intl.Collator([], {sensitivity:'accent'}) | ||
data.sort((a, b) => collator.compare(a[sortDataBy], b[sortDataBy])) | ||
} | ||
data.forEach(countryData => { | ||
@@ -50,0 +56,0 @@ let collectionObject = {} |
{ | ||
"name": "country-codes-list", | ||
"version": "1.4.0", | ||
"version": "1.5.1", | ||
"description": "List of codes per country (languages, calling codes, currency codes, etc)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
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
110819
3583