File tree Expand file tree Collapse file tree 3 files changed +2
-26
lines changed Expand file tree Collapse file tree 3 files changed +2
-26
lines changed Original file line number Diff line number Diff line change 11var config = {
22 defaultFilename : 'index.html' ,
3- log : false ,
43 sources : [
54 {
65 selector : 'img' ,
@@ -33,7 +32,7 @@ var config = {
3332 {
3433 selector : 'link[rel*="icon"]' ,
3534 attr : 'href'
36- } ,
35+ }
3736 ] ,
3837 subdirectories : [
3938 {
Original file line number Diff line number Diff line change 11var url = require ( 'url' ) ;
22var path = require ( 'path' ) ;
33
4- function isUrl ( path ) {
5- var urlRegexp = / ^ ( ( h t t p [ s ] ? : ) ? \/ \/ ) / ;
6- return urlRegexp . test ( path ) ;
7- }
8-
94function getUrl ( currentUrl , path ) {
105 var pathObj = url . parse ( path ) ;
11- if ( isUrl ( path ) && ! pathObj . protocol ) {
6+ if ( ! pathObj . protocol ) {
127 pathObj . protocol = 'http' ;
138 path = url . format ( pathObj ) ;
149 }
@@ -30,7 +25,6 @@ function getFilenameFromUrl (u) {
3025}
3126
3227module . exports = {
33- isUrl : isUrl ,
3428 getUrl : getUrl ,
3529 getUnixPath : getUnixPath ,
3630 getRelativePath : getRelativePath ,
Original file line number Diff line number Diff line change @@ -2,23 +2,6 @@ require('should');
22var utils = require ( '../../lib/utils' ) ;
33
44describe ( 'Common utils' , function ( ) {
5- describe ( '#isUrl(url)' , function ( ) {
6- it ( 'should return true if url starts with "http[s]://"' , function ( ) {
7- utils . isUrl ( 'http://google.com' ) . should . be . true ( ) ;
8- utils . isUrl ( 'https://github.com' ) . should . be . true ( ) ;
9- } ) ;
10- it ( 'should return true if url starts with "//"' , function ( ) {
11- utils . isUrl ( '//www.youtube.com' ) . should . be . true ( ) ;
12- } ) ;
13- it ( 'should return false if url starts neither with "http[s]://" nor "//"' , function ( ) {
14- utils . isUrl ( 'http//www.youtube.com' ) . should . be . false ( ) ;
15- utils . isUrl ( 'http:/www.youtube.com' ) . should . be . false ( ) ;
16- utils . isUrl ( 'htt://www.youtube.com' ) . should . be . false ( ) ;
17- utils . isUrl ( '://www.youtube.com' ) . should . be . false ( ) ;
18- utils . isUrl ( 'www.youtube.com' ) . should . be . false ( ) ;
19- } ) ;
20- } ) ;
21-
225 describe ( '#getUrl(url, path)' , function ( ) {
236 it ( 'should return url + path if path is not url' , function ( ) {
247 utils . getUrl ( 'http://google.com' , '/path' ) . should . be . equal ( 'http://google.com/path' ) ;
You can’t perform that action at this time.
0 commit comments