Skip to content

Instantly share code, notes, and snippets.

@LabiKyo
Last active October 20, 2015 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LabiKyo/31af5602b64f334bdba5 to your computer and use it in GitHub Desktop.
Save LabiKyo/31af5602b64f334bdba5 to your computer and use it in GitHub Desktop.
trim string
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