Created
August 23, 2018 08:55
-
-
Save hota1024/ba8f3b43fbae9ebdaeae2e5d279e69f3 to your computer and use it in GitHub Desktop.
Boxol.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Boxol = { | |
Marked (data) { | |
let result = '' | |
let maxLength = 0 | |
data.forEach(line => { | |
maxLength = Math.max(maxLength, line.length) | |
console.log(maxLength) | |
}) | |
result += '╭' + '─'.repeat(maxLength) + '╮\n' | |
data.forEach(line => { | |
let afterPad = ' '.repeat(maxLength - line.length) | |
result += '|' + line + afterPad + '|\n' | |
}) | |
result += '╰' + '─'.repeat(maxLength) + '╯\n' | |
return result | |
}, | |
Mark (data) { | |
console.log(this.Marked(data)) | |
} | |
} | |
export default Boxol |
Author
hota1024
commented
Aug 23, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment