1
- const _ = require ( 'lodash' )
2
1
const data = require ( '../data.json' )
3
2
4
3
/**
@@ -7,7 +6,7 @@ const data = require('../data.json')
7
6
* @return {boolean }
8
7
*/
9
8
const validateLocaleCode = ( localeCode ) => {
10
- return _ . findIndex ( data , ( l ) => l . code === localeCode ) !== - 1
9
+ return data . findIndex ( ( l ) => l . code === localeCode ) !== - 1
11
10
}
12
11
13
12
/**
@@ -16,7 +15,7 @@ const validateLocaleCode = (localeCode) => {
16
15
* @return {boolean }
17
16
*/
18
17
const validateLanguageCode = ( languageCode ) => {
19
- return _ . findIndex ( data , ( l ) => l . langCode === languageCode ) !== - 1
18
+ return data . findIndex ( ( l ) => l . langCode === languageCode ) !== - 1
20
19
}
21
20
22
21
/**
@@ -25,7 +24,7 @@ const validateLanguageCode = (languageCode) => {
25
24
* @return {string[] } Languages list
26
25
*/
27
26
const findCountryLanguages = ( countryCode ) => {
28
- const countryEntries = _ . filter ( data , ( l ) => l . countryCode === countryCode )
27
+ const countryEntries = data . filter ( ( l ) => l . countryCode === countryCode )
29
28
const langSet = new Set ( )
30
29
31
30
countryEntries . forEach ( ( e , i ) => langSet . add ( countryEntries [ i ] . langCode ) )
@@ -39,7 +38,7 @@ const findCountryLanguages = (countryCode) => {
39
38
* @return {string[] } Locales list
40
39
*/
41
40
const findCountryLocales = ( countryCode ) => {
42
- const countryEntries = _ . filter ( data , ( l ) => l . countryCode === countryCode )
41
+ const countryEntries = data . filter ( ( l ) => l . countryCode === countryCode )
43
42
const localeSet = new Set ( )
44
43
45
44
countryEntries . forEach ( ( e , i ) => localeSet . add ( countryEntries [ i ] . code ) )
0 commit comments