Last active
October 20, 2015 07:16
-
-
Save LabiKyo/31af5602b64f334bdba5 to your computer and use it in GitHub Desktop.
trim string
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
import readline from 'readline'; | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); | |
const REGEX = /(\d)(\d+)/g; | |
let results = []; | |
rl.on('line', (line) => { | |
let result = []; | |
let matched; | |
while (matched = REGEX.exec(line)) { | |
result.push(matched[1]); | |
} | |
results.push(' - styleIds.push(' + result.join(', ') + ')'); | |
}); | |
rl.on('close', () => { | |
console.log(results.join('\n')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment