Comparing version 0.0.5 to 0.0.6
17
index.js
@@ -1219,3 +1219,3 @@ const events = require('events'); | ||
}; | ||
exokit.fetch = (url, options) => fetch(url) | ||
exokit.fetch = src => fetch(src) | ||
.then(res => { | ||
@@ -1225,7 +1225,18 @@ if (res.status >= 200 && res.status < 300) { | ||
} else { | ||
return Promise.reject(new Error('fetch got invalid status code: ' + res.status + ' : ' + url)); | ||
return Promise.reject(new Error('fetch got invalid status code: ' + res.status + ' : ' + src)); | ||
} | ||
}) | ||
.then(htmlString => exokit(htmlString, options)); | ||
.then(htmlString => { | ||
const parsedUrl = url.parse(src); | ||
return exokit(htmlString, { | ||
url: (parsedUrl.protocol || 'http:') + '//' + (parsedUrl.host || '127.0.0.1'), | ||
}); | ||
}); | ||
exokit.THREE = THREE; | ||
module.exports = exokit; | ||
if (require.main === module) { | ||
if (process.argv.length === 3) { | ||
exokit.fetch(process.argv[2]); | ||
} | ||
} |
{ | ||
"name": "exokit", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
81476
2631