File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,23 @@ case undefined:
13
13
console . log ( "No parameters given. -h or --help for usage instructions." ) ;
14
14
break ;
15
15
default :
16
- if ( matrix [ country ] === undefined ) {
16
+ if ( matrix . filter ( function ( x ) {
17
+ return x . country === country ;
18
+ } ) . length === 0 ) {
17
19
console . log ( "Country not found." ) ;
18
20
break ;
19
21
}
20
22
switch ( language ) {
21
23
case undefined :
22
- console . log ( matrix [ country ] ) ;
24
+ console . log ( matrix . filter ( function ( x ) {
25
+ return x . country === country ;
26
+ } ) . shift ( ) . languages ) ;
23
27
break ;
24
28
default :
25
- console . log ( matrix [ country ] . indexOf ( language ) > - 1 ? true : false ) ;
29
+ console . log ( matrix . filter ( function ( countries ) {
30
+ return countries . country === country ;
31
+ } ) . filter ( function ( countryLang ) {
32
+ return countryLang . languages == language ;
33
+ } ) . length > 0 ? true : false ) ;
26
34
}
27
35
}
28
-
You can’t perform that action at this time.
0 commit comments