3 ms·
Yes and both can be expressed in js and jq. Poinjt is what JS is known by much more peopel. As fx uses Node or Deno we for example can use lodash in fx: fx
by medv 3y ago
Yes and both can be expressed in js and jq. Poinjt is what JS is known by much more peopel. As fx uses Node or Deno we for example can use lodash in fx:
fx '_.groupBy("commit.author.name")' '_.mapValues(size)'
'_.toPairs' '_.sortBy(1)' '_.reverse' '_.take(10)' '_.fromPairs'
To do if in jq, it will take me much more time and extensive documentation reading.
- gcr 3y agoWhat’s the original JSON? Happy to try and express this in jq
- maleldil 3y agoLooks like the GitHub API: https://docs.github.com/en/free-pro-team@latest/rest/commits/commits?apiVersion=2022-11-28#list-commits https://docs.github.com/en/free-pro-team@latest/rest/commits... I'm looking forward to your jq version. I love jq and use it all the time, but for anything of that complexity, I'd probably just use Python.
- wwader 3y agoIf the task was the produce an object with the top 10 commiters with username as key and value number of commits maybe something liket this: group_by(.commit.author.name) | map({key: first.commit.author.name, value: length}) | sort_by(.value) | reverse[:10] | from_entries