File size: 501 Bytes
78c921d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Section {
  constructor () {
    this.lines = []
  }

  add (lines) {
    if (lines) {
      const arrayify = require('array-back')
      arrayify(lines).forEach(line => this.lines.push(line))
    } else {
      this.lines.push('')
    }
  }

  toString () {
    const os = require('os')
    return this.lines.join(os.EOL)
  }

  header (text) {
    const chalk = require('chalk')
    if (text) {
      this.add(chalk.underline.bold(text))
      this.add()
    }
  }
}

module.exports = Section