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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
function getSource(state, actor) {
return state.sources.sources[actor];
}
function getSources(state) {
return state.sources.sources;
}
function getSourceCount(state) {
return Object.keys(state.sources.sources).length;
}
function getSourceByURL(state, url) {
for (let k in state.sources.sources) {
const source = state.sources.sources[k];
if (source.url === url) {
return source;
}
}
}
function getSourceByActor(state, actor) {
for (let k in state.sources.sources) {
const source = state.sources.sources[k];
if (source.actor === actor) {
return source;
}
}
}
function getSelectedSource(state) {
return state.sources.sources[state.sources.selectedSource];
}
function getSelectedSourceOpts(state) {
return state.sources.selectedSourceOpts;
}
function getSourceText(state, actor) {
return state.sources.sourcesText[actor];
}
function getBreakpoints(state) {
return Object.keys(state.breakpoints.breakpoints).map(k => {
return state.breakpoints.breakpoints[k];
});
}
function getBreakpoint(state, location) {
return state.breakpoints.breakpoints[makeLocationId(location)];
}
function makeLocationId(location) {
return location.actor + ":" + location.line.toString();
}
module.exports = {
getSource,
getSources,
getSourceCount,
getSourceByURL,
getSourceByActor,
getSelectedSource,
getSelectedSourceOpts,
getSourceText,
getBreakpoint,
getBreakpoints,
makeLocationId
};
|