Created
June 17, 2020 07:51
-
-
Save alice1017/59522097a8a084d4780c909ae61ea5ee to your computer and use it in GitHub Desktop.
This file contains 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
const chalk = require("chalk"); | |
const columnify = require("columnify"); | |
const data = [ | |
{ | |
no: 1, | |
branch: "master", | |
refer: "0123456789abcdef" | |
}, | |
{ | |
no: 2, | |
branch: "origin/master", | |
refer: "0123456789abcdef" | |
} | |
]; | |
const config = { | |
config: { | |
no: { | |
align: "right", | |
dataTransform: data => { | |
return chalk.yellow(data); | |
} | |
} | |
}, | |
headingTransform: head => { | |
return chalk.underline(head.toUpperCase()); | |
} | |
}; | |
const columns = columnify(data, config); | |
console.log(columns); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment