-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathNormalizeOptionTask.js
More file actions
34 lines (27 loc) · 875 Bytes
/
NormalizeOptionTask.js
File metadata and controls
34 lines (27 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import ValueReader from '../../readers/ValueReader';
import ObjectReader from '../../readers/ObjectReader';
import EnumerationReader from '../../readers/EnumerationReader';
import { GroupByType } from '../../enums';
export default function NormalizeOptionTask(optionsTask, defaultConfig) {
var _data = {},
_hash = {};
var _dataTemplate = new ObjectReader({
groupByType: new EnumerationReader(GroupByType, false, defaultConfig.groupByType),
alignBylevels: new ValueReader(["boolean"], false, defaultConfig.alignBylevels)
});
function process() {
var context = {
isChanged: false,
hash: _hash
};
_data = _dataTemplate.read(_data, optionsTask.getOptions(), "options", context);
return context.isChanged;
}
function getOptions() {
return _data;
}
return {
process: process,
getOptions: getOptions
};
};