DEV Community

Mehedi Hasan
Mehedi Hasan

Posted on

How I can make Function Like Chalk.bold.red()?

const chalk = require('chalk')
const error = chalk.bold.red; // <= Here
console.log(chalk.bold.white("test")) // <= Here
console.log(error('Error!'));

As you can see, the method "chalk.bold.red" is stored in a variable where it can subsequently be invoked as a naked Function object. And How can I make my Own? Such as:

const bold

Top comments (0)