nomics-platform
Advanced tools
Comparing version 0.2.1 to 0.3.0
const https = require('https') | ||
const http = require('http') | ||
module.exports = function (u) { | ||
return new Promise((resolve, reject) => { | ||
https.get(u, (res) => { | ||
const handler = (res) => { | ||
const { statusCode } = res | ||
@@ -30,6 +31,10 @@ const contentType = res.headers['content-type'] | ||
}) | ||
}).on('error', (e) => { | ||
reject(e) | ||
}) | ||
} | ||
if (u.indexOf('https') === 0) { | ||
https.get(u, handler).on('error', (e) => { reject(e) }) | ||
} else { | ||
http.get(u, handler).on('error', (e) => { reject(e) }) | ||
} | ||
}) | ||
} |
@@ -20,3 +20,6 @@ const url = require('url') | ||
const results = [] | ||
results.push(...await require('./info')(u)) | ||
results.push(...await require('./market')(u)) | ||
results.push(...await require('./trade')(u)) | ||
@@ -23,0 +26,0 @@ console.log(results.map((r) => r.toString()).join('\n')) |
@@ -9,6 +9,6 @@ const get = require('./get') | ||
const info = await get(u + '/info') | ||
results.push(new Result(true, true, 'Fetched /info and parsed as JSON')) | ||
results.push(new Result(true, true, '/info is valid JSON')) | ||
results.push(...auditInfoData(info)) | ||
} catch (e) { | ||
results.push(new Result(false, true, 'Failed to fetch /info and parse as JSON', e)) | ||
results.push(new Result(false, true, '/info failed or not JSON', e)) | ||
} | ||
@@ -21,9 +21,9 @@ return results | ||
results.push(validateStringProperty(info, 'name', true, 'Info')) | ||
results.push(validateStringProperty(info, 'description', false, 'Info')) | ||
results.push(validateStringProperty(info, 'logo', false, 'Info')) | ||
results.push(validateURLProperty(info, 'logo', false, 'Info')) | ||
results.push(validateStringProperty(info, 'website', false, 'Info')) | ||
results.push(validateURLProperty(info, 'website', false, 'Info')) | ||
results.push(validateStringProperty(info, 'twitter', false, 'Info')) | ||
results.push(validateStringProperty(info, 'name', true, '/info')) | ||
results.push(validateStringProperty(info, 'description', false, '/info')) | ||
results.push(validateStringProperty(info, 'logo', false, '/info')) | ||
results.push(validateURLProperty(info, 'logo', false, '/info')) | ||
results.push(validateStringProperty(info, 'website', false, '/info')) | ||
results.push(validateURLProperty(info, 'website', false, '/info')) | ||
results.push(validateStringProperty(info, 'twitter', false, '/info')) | ||
@@ -30,0 +30,0 @@ return results |
{ | ||
"name": "nomics-platform", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Nomics Platform Toolkit", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14753
12
367
2