@@ -9,6 +9,10 @@ function notEnabled(command) {
99 } ;
1010}
1111
12+ function trimLabels ( labels ) {
13+ return labels . map ( ( it ) => it . trim ( ) ) ;
14+ }
15+
1216export function transferEnabled ( config ) {
1317 if ( ! config . commands . transfer . enabled ) {
1418 return notEnabled ( "transfer" ) ;
@@ -24,14 +28,15 @@ export function labelEnabled(config, labels) {
2428 return notEnabled ( "label" ) ;
2529 }
2630
31+ const allowedLabels = trimLabels ( labelConfig . allowedLabels ) ;
2732 if (
2833 // if length is = 0 then all labels are allowed
29- labelConfig . allowedLabels . length > 0 &&
30- ! labels . every ( ( label ) => labelConfig . allowedLabels . includes ( label ) )
34+ allowedLabels . length > 0 &&
35+ ! labels . every ( ( label ) => allowedLabels . includes ( label ) )
3136 ) {
3237 return {
3338 enabled : false ,
34- error : `${ labels } doesn't match the allowed labels \`${ labelConfig . allowedLabels . join (
39+ error : `${ labels } doesn't match the allowed labels \`${ allowedLabels . join (
3540 "," ,
3641 ) } \``,
3742 } ;
@@ -62,14 +67,15 @@ export function removeLabelEnabled(config, labels) {
6267 return notEnabled ( "remove-label" ) ;
6368 }
6469
70+ const allowedLabels = trimLabels ( labelConfig . allowedLabels ) ;
6571 if (
6672 // if length is = 0 then all labels are allowed
67- labelConfig . allowedLabels . length > 0 &&
68- ! labels . every ( ( label ) => labelConfig . allowedLabels . includes ( label ) )
73+ allowedLabels . length > 0 &&
74+ ! labels . every ( ( label ) => allowedLabels . includes ( label ) )
6975 ) {
7076 return {
7177 enabled : false ,
72- error : `${ labels } doesn't match the allowed labels \`${ labelConfig . allowedLabels . join (
78+ error : `${ labels } doesn't match the allowed labels \`${ allowedLabels . join (
7379 "," ,
7480 ) } \``,
7581 } ;
0 commit comments