This repository was archived by the owner on Jan 27, 2019. It is now read-only.
File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
var q = require ( 'q' ) ;
4
4
var isCss = require ( 'is-css' ) ;
5
+ var isBlank = require ( 'is-blank' )
6
+ var isUrl = require ( 'is-url-superb' )
5
7
var request = require ( 'request' ) ;
6
8
var cheerio = require ( 'cheerio' ) ;
7
9
var normalizeUrl = require ( 'normalize-url' ) ;
@@ -20,7 +22,11 @@ module.exports = function(url, options){
20
22
options . timeout = options . timeout || 5000 ;
21
23
options . gzip = true ;
22
24
23
- url = normalizeUrl ( url ) ;
25
+ if ( typeof url !== 'string' || isBlank ( url ) || ! isUrl ( url ) ) {
26
+ throw new TypeError ( 'get-css expected a url as a string' )
27
+ }
28
+
29
+ url = normalizeUrl ( url , { stripWWW : false } ) ;
24
30
options . url = url ;
25
31
26
32
if ( options . ignoreCerts ) {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " get-css" ,
3
- "version" : " 1.1.1 " ,
3
+ "version" : " 1.2.0 " ,
4
4
"description" : " Get CSS from a URL" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
12
12
"author" : " Brent Jackson" ,
13
13
"license" : " MIT" ,
14
14
"dependencies" : {
15
- "cheerio" : " ^0.18 .0" ,
15
+ "cheerio" : " ^0.19 .0" ,
16
16
"commander" : " ^2.7.1" ,
17
+ "is-blank" : " ^1.0.0" ,
17
18
"is-css" : " ^1.0.0" ,
19
+ "is-url-superb" : " ^2.0.0" ,
18
20
"normalize-url" : " ^1.2.0" ,
19
21
"q" : " ^1.1.2" ,
20
22
"request" : " ^2.48.0" ,
21
- "resolve-css-import-urls" : " 0.0.2 " ,
23
+ "resolve-css-import-urls" : " 0.0.3 " ,
22
24
"strip-html-comments" : " 0.0.2"
23
25
},
24
26
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments