Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "readline", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Simple streaming readline module.", | ||
@@ -5,0 +5,0 @@ "main": "readline.js", |
@@ -40,3 +40,6 @@ var fs = require('fs'), | ||
// Emit last line if anything left over since EOF won't trigger it. | ||
if (line.length) emit(line, lineCount); | ||
if (line.length){ | ||
lineCount++; | ||
emit(line, lineCount); | ||
} | ||
self.emit('end'); | ||
@@ -43,0 +46,0 @@ }) |
@@ -6,3 +6,4 @@ ## _readline_ | ||
## Important. In node 10 there is a core module named readline. Please use linebyline instead, it is the same module just renamed | ||
## Important. In node 10 there is a core module named readline. Please use linebyline instead, it is the same module just renamed: | ||
[Npm linebyline](https://www.npmjs.com/package/linebyline) | ||
@@ -13,2 +14,10 @@ ```sh | ||
## Test | ||
```sh | ||
npm install . | ||
npm test | ||
``` | ||
## What's this? | ||
@@ -15,0 +24,0 @@ |
@@ -6,3 +6,3 @@ var test = require("tap").test; | ||
var rl = readLine('./fixtures/afile.txt'); | ||
rl.on("line", function (line){ | ||
rl.on("line", function (line,linecount){ | ||
t.ok(null !== line && undefined !== line); | ||
@@ -28,3 +28,3 @@ }); | ||
console.error(i,answer); | ||
t.ok(answer === i, "I is wrong " + i); | ||
t.ok(answer === i, "answered"); | ||
t.end(); | ||
@@ -50,1 +50,16 @@ }); | ||
test("line count", function(t){ | ||
var rl = readLine('./fixtures/nmbr.txt'); | ||
var expect = 7; | ||
var actual = 0; | ||
rl.on("line", function (line, ln){ | ||
console.log("line",line,ln); | ||
actual=ln; | ||
}); | ||
rl.on("end", function (){ | ||
t.ok(actual === expect,"line count is correct"); | ||
t.end(); | ||
}); | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1955265
101
40