File tree 8 files changed +121
-1914
lines changed 8 files changed +121
-1914
lines changed Original file line number Diff line number Diff line change 1
- var utility = require ( '../utility/strings' )
2
- var Xray = require ( 'x-ray' )
3
- var x = Xray ( )
1
+ let utility = require ( '../utility/strings' ) ,
2
+ Xray = require ( 'x-ray' ) ,
3
+ x = Xray ( ) ;
4
4
5
-
6
- // valid-url set
7
- // external-url set
8
- // invalid-url set
5
+ // crawl function takes url in parameter and return values of attribute
6
+ // 'href' from all anchor tags
9
7
exports . crawl = function ( url ) {
10
8
return new Promise ( ( resolve , reject ) => {
11
9
x ( url , {
Original file line number Diff line number Diff line change
1
+ const webCrawler = require ( './queue/queue' )
2
+
3
+ if ( process . argv . length === 4 ) {
4
+ webCrawler ( process . argv [ 2 ] , process . argv [ 3 ] ) ;
5
+ }
6
+ else {
7
+ console . log ( "Invalid CLI Arguments" ) ;
8
+
9
+ }
Original file line number Diff line number Diff line change @@ -5,20 +5,15 @@ function Urls() {
5
5
}
6
6
7
7
Urls . prototype . addToValidUrlSet = function ( value ) {
8
- console . log ( value ) ;
9
-
10
8
this . validUrlSet . add ( value ) ;
11
9
}
12
10
Urls . prototype . addToExternalUrlSet = function ( value ) {
13
- console . log ( value )
14
11
this . externalUrlSet . add ( value ) ;
15
12
}
16
13
Urls . prototype . addToInvalidUrlSet = function ( value ) {
17
14
this . invalidUrlSet . add ( value ) ;
18
15
}
19
- Urls . prototype . isContains = function ( set , value ) {
20
- console . log ( "THE SET IS " , set ) ;
21
-
16
+ Urls . prototype . isContains = function ( set , value ) {
22
17
return set . has ( value ) ;
23
18
}
24
19
Urls . prototype . getValidUrlSet = function ( ) {
@@ -28,7 +23,7 @@ Urls.prototype.getExternalUrlSet = function () {
28
23
return this . externalUrlSet ;
29
24
}
30
25
Urls . prototype . getInvalidUrlSet = function ( ) {
31
- return this . getInvalidUrlSet ;
26
+ return this . invalidUrlSet ;
32
27
}
33
28
34
29
module . exports = Urls ;
You can’t perform that action at this time.
0 commit comments