Skip to content

Instantly share code, notes, and snippets.

@alice1017
Created June 17, 2020 07:51
Show Gist options
  • Save alice1017/59522097a8a084d4780c909ae61ea5ee to your computer and use it in GitHub Desktop.
Save alice1017/59522097a8a084d4780c909ae61ea5ee to your computer and use it in GitHub Desktop.
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