File size: 272 Bytes
be5030f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const chalk = require('chalk')

function format (str) {
  return chalk(Object.assign([], { raw: [ str ] }))
}

function chalkFormat (str) {
  if (str) {
    str = str.replace(/`/g, '\\`')
    return format(str)
  } else {
    return ''
  }
}

module.exports = chalkFormat