Skip to content

Commit 7bc2852

Browse files
committed
Merge pull request #2 from llaumgui/master
Proxy patch
2 parents 2b472ff + 9402e23 commit 7bc2852

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/W3CValidator.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var pkg = require("../package.json");
2020
program.version(pkg.version)
2121
.usage("[options] <url>")
2222
.option("-l, --log", "log errors in a text file")
23+
.option("-m, --max <n>", "max URLs to crawl")
2324
.option("-q, --query", "consider query string")
2425
.option("-v, --verbose", "show error details")
2526
.parse(process.argv);
@@ -160,6 +161,10 @@ W3CValidator.prototype.create = function() {
160161

161162
this.crawler.on("fetchcomplete", (item) => {
162163
this.chunk.push(item.url);
164+
if (program.max && this.chunk.length >= program.max) {
165+
this.crawler.emit("complete");
166+
this.crawler.stop();
167+
}
163168
});
164169

165170
this.crawler.on("complete", () => {

0 commit comments

Comments
 (0)