mirror of
https://github.com/Rushilwiz/spaceout.git
synced 2025-04-21 20:09:50 -04:00
30 lines
501 B
JavaScript
30 lines
501 B
JavaScript
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
|