Last active
August 1, 2018 22:00
-
-
Save rwaldron/d99fab1594f8a15d3dd2b3e56fcbe09a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
mkdir sort-audit; | |
cd sort-audit; | |
npm init -y; | |
npm install glob; | |
wget https://gist.githubusercontent.com/rwaldron/d99fab1594f8a15d3dd2b3e56fcbe09a/raw/audit.js | |
wget https://s3.amazonaws.com/test-results.bocoup.com/test262/parsed-v8.json | |
wget https://s3.amazonaws.com/test-results.bocoup.com/test262/parsed-chakra.json | |
wget https://s3.amazonaws.com/test-results.bocoup.com/test262/parsed-javascriptcore.json | |
node audit.js | |
*/ | |
const fs = require("fs"); | |
const path = require("path"); | |
const glob = require("glob"); | |
const results = glob.sync('parsed-*.json').map(file => JSON.parse(fs.readFileSync(path.join(__dirname, file), 'utf8'))); | |
const indices = [[], [], []]; | |
function traverse(object, index) { | |
object.children.forEach(child => { | |
if (Array.isArray(child.children)) { | |
traverse(child, index); | |
} else { | |
indices[index].push(child.name); | |
} | |
}); | |
} | |
results.forEach(traverse); | |
const length = indices[0].length; | |
for (var i = 0; i < length; i++) { | |
console.log(i); | |
console.log(indices[0][i]); | |
console.log(indices[1][i]); | |
console.log(indices[2][i]); | |
console.log('----------------'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment