forked from csuwildcat/DXCrawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browserbite-analyzer.js
36 lines (22 loc) · 1.07 KB
/
browserbite-analyzer.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
var fs = require('fs');
var _ = require('lodash');
var fileName = 'browserbiteresults.json';
var websites = JSON.parse(fs.readFileSync(fileName, 'utf8'));
var info = _.reduce(websites, function (acum, current, key) {
acum.push(_.merge(current, { website: key }));
return acum;
}, []);
console.log(info[0]);
console.log('Total websites: ' + info.length);
var iepassed = _.filter(info, { results: { "ie11.0": { passes: true } } });
console.log('IE Passed: ' + iepassed.length);
var ffpassed = _.filter(info, { results: { firefox32: { passes: true } } });
console.log('FF Passed: ' + ffpassed.length);
var nonPassedFFandIE = _.filter(info, function (elem) {
var passedFF = (elem.results.firefox32 && elem.results.firefox32.passes) || false;
var passedIE = (elem.results["ie11.0"] && elem.results["ie11.0"].passes) || false;
return !passedFF && !passedIE;
});
console.log('IE & FF failed: ' + nonPassedFFandIE.length);
fs.writeFileSync('dudosos.json', JSON.stringify(nonPassedFFandIE, null, 2));
console.log('done');