Last active
February 18, 2018 10:47
-
-
Save ckiee/8efe7e0d4e6deecf94f2f22b744f0b9d to your computer and use it in GitHub Desktop.
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 fs = require("fs") ; | |
const code = fs.readFileSync("kslaslala.js").toString().split("\r").join("") ; | |
const validChars = "{;})".split("") ; | |
const lines = code.split("\n") ; | |
let badchars = "" ; | |
for (let line of lines) { | |
console.log(padCharToEnd(line) ) | |
} | |
/** | |
* @param {String} line | |
* @returns {String} | |
*/ | |
function padCharToEnd(line) { | |
const lastChar = line[line.length-1] ; | |
if (validChars.indexOf(lastChar) == -1) return line ; | |
line = line.slice(0, line.length-1) ; | |
const length = -(line.length-99) ; | |
line+=new Array(length).join(" ")+lastChar; | |
return line ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment