File tree 1 file changed +12
-9
lines changed
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -34,21 +34,24 @@ async function onList() {
34
34
35
35
async function onCurrent ( { showUrl } ) {
36
36
const currentRegistry = await getCurrentRegistry ( ) ;
37
- let usingUnknownRegistry = true ;
38
37
const registries = await getRegistries ( ) ;
39
- for ( const name in registries ) {
40
- const registry = registries [ name ] ;
41
- if ( isLowerCaseEqual ( registry [ REGISTRY ] , currentRegistry ) ) {
42
- usingUnknownRegistry = false ;
43
- printMessages ( [ `You are using ${ chalk . green ( showUrl ? registry [ REGISTRY ] : name ) } registry.` ] ) ;
44
- }
45
- }
46
- if ( usingUnknownRegistry ) {
38
+
39
+ const matchedRegistry = Object . entries ( registries ) . find ( ( [ _name , registry ] ) =>
40
+ isLowerCaseEqual ( registry [ REGISTRY ] , currentRegistry ) ,
41
+ ) ;
42
+
43
+ // not find equal registry
44
+ if ( ! matchedRegistry ) {
47
45
printMessages ( [
48
46
`Your current registry(${ currentRegistry } ) is not included in the nrm registries.` ,
49
47
`Use the ${ chalk . green ( 'nrm add <registry> <url> [home]' ) } command to add your registry.` ,
50
48
] ) ;
49
+ return ;
51
50
}
51
+
52
+ printMessages ( [
53
+ `You are using ${ chalk . green ( showUrl ? matchedRegistry . registry [ REGISTRY ] : matchedRegistry . name ) } registry.` ,
54
+ ] ) ;
52
55
}
53
56
54
57
async function onUse ( name ) {
You can’t perform that action at this time.
0 commit comments