-
Notifications
You must be signed in to change notification settings - Fork 1
/
print.js
126 lines (97 loc) · 3.87 KB
/
print.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
'use strict';
const table = require('cli-table');
const triggerData = require('./data/data.json');
module.exports = print;
function print(results, callback) {
const resultsList = new table({
head: ['Trigger', 'Line', 'Change from default', 'Subsequent']
});
results.forEach(function(result) {
resultsList.push(buildRowData(result));
});
console.log(resultsList.toString());
}
function buildRowData(data) {
const prop = data.property;
const line = data.position.start.line;
const propertyData = triggerData.data[prop];
const initialData = propertyData.initial;
const updateData = propertyData.change;
const blinkInit = initialData.blink;
const geckoInit = initialData.gecko;
const webkitInit = initialData.webkit;
const edgeInit = initialData.edgehtml;
const blinkSub = updateData.blink;
const geckoSub = updateData.gecko;
const webkitSub = updateData.webkit;
const edgeSub = updateData.edgehtml;
const blinkLayoutInit = blinkInit.layout;
const blinkPaintInit = blinkInit.paint;
const blinkCompInit = blinkInit.composite;
const geckoLayoutInit = geckoInit.layout;
const geckoPaintInit = geckoInit.paint;
const geckoCompInit = geckoInit.composite;
const webkitLayoutInit = webkitInit.layout;
const webkitPaintInit = webkitInit.paint;
const webkitCompInit = webkitInit.composite;
const edgeLayoutInit = edgeInit.layout;
const edgePaintInit = edgeInit.paint;
const edgeCompInit = edgeInit.composite;
const blinkLayoutSub = blinkSub.layout;
const blinkPaintSub = blinkSub.paint;
const blinkCompSub = blinkSub.composite;
const geckoLayoutSub = geckoSub.layout;
const geckoPaintSub = geckoSub.paint;
const geckoCompSub = geckoSub.composite;
const webkitLayoutSub = webkitSub.layout;
const webkitPaintSub = webkitSub.paint;
const webkitCompSub = webkitSub.composite;
const edgeLayoutSub = edgeSub.layout;
const edgePaintSub = edgeSub.paint;
const edgeCompSub = edgeSub.composite;
var finalBlinkInitResult = 'B: ';
var finalBlinkSubResult = 'B: ';
var finalWebkitInitResult = 'W: ';
var finalWebkitSubResult = 'W: ';
var finalGeckoInitResult = 'G: ';
var finalGeckoSubResult = 'G: ';
var finalEdgeInitResult = 'E: ';
var finalEdgeSubResult = 'E: ';
if (blinkLayoutInit) finalBlinkInitResult += 'Layout ';
if (blinkPaintInit) finalBlinkInitResult += 'Paint ';
if (blinkCompInit) finalBlinkInitResult += 'Composite ';
if (geckoLayoutInit) finalGeckoInitResult += 'Layout ';
if (geckoPaintInit) finalGeckoInitResult += 'Paint ';
if (geckoCompInit) finalGeckoInitResult += 'Composite ';
if (webkitLayoutInit) finalWebkitInitResult += 'Layout ';
if (webkitPaintInit) finalWebkitInitResult += 'Paint ';
if (webkitCompInit) finalWebkitInitResult += 'Composite ';
if (edgeLayoutInit) finalEdgeInitResult += 'Layout ';
if (edgePaintInit) finalEdgeInitResult += 'Paint ';
if (edgeCompInit) finalEdgeInitResult += 'Composite ';
if (blinkLayoutSub) finalBlinkSubResult += 'Layout ';
if (blinkPaintSub) finalBlinkSubResult += 'Paint ';
if (blinkCompSub) finalBlinkSubResult += 'Composite ';
if (geckoLayoutSub) finalGeckoSubResult += 'Layout ';
if (geckoPaintSub) finalGeckoSubResult += 'Paint ';
if (geckoCompSub) finalGeckoSubResult += 'Composite ';
if (webkitLayoutSub) finalWebkitSubResult += 'Layout ';
if (webkitPaintSub) finalWebkitSubResult += 'Paint ';
if (webkitCompSub) finalWebkitSubResult += 'Composite ';
if (edgeLayoutSub) finalEdgeSubResult += 'Layout ';
if (edgePaintSub) finalEdgeSubResult += 'Paint ';
if (edgeCompSub) finalEdgeSubResult += 'Composite ';
const initResult = [
finalBlinkInitResult,
finalGeckoInitResult,
finalWebkitInitResult,
finalEdgeInitResult
].join('\n');
const subResult = [
finalBlinkSubResult,
finalGeckoSubResult,
finalWebkitSubResult,
finalEdgeSubResult
].join('\n');
return [prop, line, initResult, subResult];
}