Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Last active August 1, 2018 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwaldron/d99fab1594f8a15d3dd2b3e56fcbe09a to your computer and use it in GitHub Desktop.
Save rwaldron/d99fab1594f8a15d3dd2b3e56fcbe09a to your computer and use it in GitHub Desktop.
/*
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