Repository navigation
Suggestion: Add lineNumber #8393
Copy link
Copy link
Closed
adamlaska/node
#38Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
Description
Activity
- addedreadlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
on Sep 2, 2016 ... read a line number of a module
@ev1stensberg Can you give an example?
I have a config file, where user can input line number and a string. (linenumber is
lineNumber&&queryis string),if the line number is correct and the string is the same as in the config, we log and write to the
output.txtfile.Let me know if this was unclear!
const readline = require('readline') const fs = require("fs") module.exports = function(){ const outi = fs.createWriteStream('output.txt') const rl = readline.createInterface({ input: fs.createReadStream('input.txt') }) let counter = 0; rl.on('line', (line) => { ++counter lineNumber.filter( (lines) => { if(lines === counter) { query.filter ( (pair) => { if(pair === line) { console.log("yess", line) outi.write(pair) } }) } }) }) }
Compared, having
lineNumber, I could make this less volatile and perhaps cut some loops off.const rl = readline.createInterface({ input: process.stdin, output: process.stdout, LineNumber: line.number });
This is rather a crazy idea, but having this run in parallell, so we could do something like
lineNumber.filter( (number) => { if(rl.LineNumber === number) { console.log("yeeey") }
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Sep 2, 2016 As I mentioned in the PR related to this, I am -1 on this idea. It's easy enough to do in userland and IMHO adding it to core would be a sign of feature creep.
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
Right now, I can't find out how to read a line number of a module, using
readLine. I thought this was already implemented, but it is not :/ Is there anyway to get this to work / find out a line number of a module?