File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,7 @@ DocUtils.loadDoc= (path,options={}) ->
7575 loadFile (result)
7676 ,async
7777 else
78- httpRegex = new RegExp " (https?)" ," i"
79- # httpsRegex= new RegExp "(https)://"
80- if httpRegex .test (path)
78+ if path .indexOf (" http" )== 0
8179 urloptions = (url .parse (path))
8280 options =
8381 hostname : urloptions .hostname
@@ -102,22 +100,19 @@ DocUtils.loadDoc= (path,options={}) ->
102100 when ' http:'
103101 req = http .request (options, reqCallback).on (' error' ,errorCallback)
104102 req .end ();
105-
106103 else
107104 if async == true
108105 fs .readFile totalPath," binary" , (err , data ) ->
109106 if err
110- if callback? then return callback (true )
107+ if callback? then return callback (err )
111108 else
112- loadFile (data)
113- if callback? then return callback (data)
109+ return loadFile (data)
114110 else
115111 try
116112 data = fs .readFileSync (totalPath," binary" )
117- a = loadFile (data)
118- if callback? then return callback (data) else return a
113+ return loadFile (data)
119114 catch e
120- if callback? then return callback ()
115+ if callback? then return callback (e )
121116
122117DocUtils .loadHttp = (result ,callback ,async = false )->
123118 if DocUtils .env == ' node'
You can’t perform that action at this time.
0 commit comments