File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,8 @@ const slots = new Set(".");
10
10
11
11
export const getMetadata = ( rawValue : string , countriesList : typeof countries = countries , country : any = null ) => {
12
12
country = country == null && rawValue . startsWith ( "44" ) ? "gb" : country ;
13
- if ( country != null ) {
14
- countriesList = countriesList . filter ( ( c ) => c [ 0 ] === country ) ;
15
- countriesList = countriesList . sort ( ( a , b ) => b [ 2 ] . length - a [ 2 ] . length ) ;
16
- }
17
- return countriesList . find ( ( c ) => rawValue . startsWith ( c [ 2 ] ) ) ;
13
+ if ( country != null ) countriesList = countriesList . filter ( ( c ) => c [ 0 ] === country ) ;
14
+ return [ ...countriesList ] . sort ( ( a , b ) => b [ 2 ] . length - a [ 2 ] . length ) . find ( ( c ) => rawValue . startsWith ( c [ 2 ] ) ) ;
18
15
}
19
16
20
17
export const getCountry = ( countryCode : keyof typeof countries ) => {
You can’t perform that action at this time.
0 commit comments