Skip to content

Instantly share code, notes, and snippets.

@nopium
Created April 12, 2020 09:20
Show Gist options
  • Select an option

  • Save nopium/1edda9357e6256d59ab666a5d0e11d42 to your computer and use it in GitHub Desktop.

Select an option

Save nopium/1edda9357e6256d59ab666a5d0e11d42 to your computer and use it in GitHub Desktop.

Revisions

  1. nopium created this gist Apr 12, 2020.
    40 changes: 40 additions & 0 deletions sort.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    // lighthouse-batch -s -p "--perf --quiet" -f urls-boats.txt -o report-lvb

    var parsedJSON = require('./report-lvb/summary.json');
    var worst = [];
    var seventies = [];
    var eighties = [];
    var nineties = [];
    console.log('Total: '+parsedJSON.length);
    for (var r in parsedJSON) {
    var row = parsedJSON[r];

    try {
    if (row.detail.performance < 0.7) {
    worst.push(row)
    console.log(row)
    }
    if (row.detail.performance < .80) {
    seventies.push(row);
    }
    else if (row.detail.performance <= .90) {
    eighties.push(row);
    }
    else if (row.detail.performance <= 1) {
    nineties.push(row);
    }
    else {
    // console.log(row);
    }

    } catch (e) {
    console.log('Exc:' + row.url)
    }

    }
    console.log('<70s: ' + worst.length);
    console.log('70s: ' + seventies.length);
    console.log('80s: ' + eighties.length);
    console.log('90s: ' + nineties.length);

    worst.map(function(e){console.log(e.url)});