1
- import _ from "underscore" ;
2
1
import { getUUID } from "@exabyte-io/code.js/dist/utils" ;
3
-
2
+ import _ from "underscore" ;
4
3
5
4
export class UnitConfigBuilder {
6
5
constructor ( { name, type } ) {
@@ -11,7 +10,7 @@ export class UnitConfigBuilder {
11
10
this . _monitors = [ ] ;
12
11
this . _preProcessors = [ ] ;
13
12
this . _postProcessors = [ ] ;
14
- this . _flowchartId = this . constructor . defaultFlowchartId ( ) ;
13
+ this . _flowchartId = this . constructor . generateFlowChartId ( ) ;
15
14
}
16
15
17
16
name ( str ) {
@@ -24,7 +23,7 @@ export class UnitConfigBuilder {
24
23
return this ;
25
24
}
26
25
27
- static defaultFlowchartId ( ) {
26
+ static generateFlowChartId ( ) {
28
27
return getUUID ( ) ;
29
28
}
30
29
@@ -33,27 +32,39 @@ export class UnitConfigBuilder {
33
32
return this ;
34
33
}
35
34
36
- _stringArrayToNamedObject ( array ) {
37
- return array . map ( name => _ . isString ( name ) ? { name} : name ) ;
35
+ static _stringArrayToNamedObject ( array ) {
36
+ return array . map ( ( name ) => ( _ . isString ( name ) ? { name } : name ) ) ;
38
37
}
39
38
40
39
addPreProcessors ( preProcessorNames ) {
41
- this . _preProcessors = _ . union ( this . _stringArrayToNamedObject ( preProcessorNames ) , this . _preProcessors ) ;
40
+ this . _preProcessors = _ . union (
41
+ this . constructor . _stringArrayToNamedObject ( preProcessorNames ) ,
42
+ this . _preProcessors ,
43
+ ) ;
42
44
return this ;
43
45
}
44
46
45
47
addPostProcessors ( postProcessorNames ) {
46
- this . _postProcessors = _ . union ( this . _stringArrayToNamedObject ( postProcessorNames ) , this . _postProcessors ) ;
48
+ this . _postProcessors = _ . union (
49
+ this . constructor . _stringArrayToNamedObject ( postProcessorNames ) ,
50
+ this . _postProcessors ,
51
+ ) ;
47
52
return this ;
48
53
}
49
54
50
55
addResults ( resultNames ) {
51
- this . _results = _ . union ( this . _stringArrayToNamedObject ( resultNames ) , this . _results ) ;
56
+ this . _results = _ . union (
57
+ this . constructor . _stringArrayToNamedObject ( resultNames ) ,
58
+ this . _results ,
59
+ ) ;
52
60
return this ;
53
61
}
54
62
55
63
addMonitors ( monitorNames ) {
56
- this . _monitors = _ . union ( this . _stringArrayToNamedObject ( monitorNames ) , this . _monitors ) ;
64
+ this . _monitors = _ . union (
65
+ this . constructor . _stringArrayToNamedObject ( monitorNames ) ,
66
+ this . _monitors ,
67
+ ) ;
57
68
return this ;
58
69
}
59
70
0 commit comments