File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -10,24 +10,18 @@ exports.validateMetricName = function (name) {
10
10
return metricRegexp . test ( name ) ;
11
11
} ;
12
12
13
- exports . validateLabelName = function ( names ) {
14
- let valid = true ;
15
- ( names || [ ] ) . forEach ( name => {
16
- if ( ! labelRegexp . test ( name ) ) {
17
- valid = false ;
18
- }
19
- } ) ;
20
- return valid ;
13
+ exports . validateLabelName = function ( names = [ ] ) {
14
+ return names . every ( name => labelRegexp . test ( name ) ) ;
21
15
} ;
22
16
23
17
exports . validateLabel = function validateLabel ( savedLabels , labels ) {
24
- Object . keys ( labels ) . forEach ( label => {
25
- if ( savedLabels . indexOf ( label ) === - 1 ) {
18
+ for ( const label in labels ) {
19
+ if ( ! savedLabels . includes ( label ) ) {
26
20
throw new Error (
27
21
`Added label "${ label } " is not included in initial labelset: ${ util . inspect (
28
22
savedLabels ,
29
23
) } `,
30
24
) ;
31
25
}
32
- } ) ;
26
+ }
33
27
} ;
You can’t perform that action at this time.
0 commit comments