sort logs

This commit is contained in:
Pedro Gomes 2019-07-02 12:11:37 +02:00
parent a8a8b65e4c
commit a6ac20e777
3 changed files with 11 additions and 3 deletions

View File

@ -938,6 +938,11 @@
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
},
"lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg="
},
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",

View File

@ -12,7 +12,8 @@
"dependencies": {
"axios": "^0.19.0",
"bignumber.js": "^9.0.0",
"dotenv": "^8.0.0"
"dotenv": "^8.0.0",
"lodash.sortby": "^4.7.0"
},
"devDependencies": {
"eslint": "^5.16.0",

View File

@ -2,6 +2,7 @@ const fs = require('fs')
const path = require('path')
const axios = require('axios')
const BigNumber = require('bignumber.js')
const sortBy = require('lodash.sortby')
require('dotenv').config()
@ -37,11 +38,12 @@ function paddedLog (...args) {
console.log(output)
}
function tableLog (array) {
function tableLog (chains) {
chains = sortBy(chains, ['chainId'])
console.log('\n')
paddedLog('Name', 'Chain', 'ChainId', 'NetworkId')
console.log('\n')
array.map(json =>
chains.map(json =>
paddedLog(json.name, json.chain, json.chainId, json.networkId)
)
console.log('\n')