Skip to content

Instantly share code, notes, and snippets.

@rwaldron rwaldron/audit.js
Last active Aug 1, 2018

Embed
What would you like to do?
/*
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
You can’t perform that action at this time.