12 lines
225 B
JavaScript
12 lines
225 B
JavaScript
function chalkFormat (str) {
|
|
if (str) {
|
|
str = str.replace(/`/g, '\\`')
|
|
const chalk = require('chalk')
|
|
return chalk(Object.assign([], { raw: [str] }))
|
|
} else {
|
|
return ''
|
|
}
|
|
}
|
|
|
|
module.exports = chalkFormat
|