Last active
February 22, 2021 12:37
-
-
Save mozfreddyb/4baa712a61d6504ad35bf995f2ab7e6c to your computer and use it in GitHub Desktop.
turn searchfox results object into audit spreadsheet
This file contains hidden or 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
/* This script can be run on a searchfox.org results page as it is. | |
* the results.normal from line 9 is already in global scope and can be iterated as it is | |
* Note that this "results.normal" does /not/ include occurences in tests or generated code. | |
* Use other properties of the "results" object instead, if you need these. | |
*/ | |
// objkey is something like "Uses (searchterm)" | |
objkey = Object.keys(results.normal)[0]; | |
occs = results.normal[objkey]; | |
t = []; | |
for (let file of occs) { | |
for (let instnce of file.lines) { | |
a = {loc: file.path+':'+instnce.lno, | |
context: instnce.context, | |
sourcetext: instnce.line | |
} | |
console.log(a.loc, '#', a.context, '#', a.sourcetext); | |
//t.push(auditline) | |
} | |
} | |
//console.table(t); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment