removed unncessary callback from convert

This commit is contained in:
Dhroov7
2019-12-09 00:24:23 +05:30
parent 2cbaa1d7be
commit 825620979f
3 changed files with 5 additions and 13 deletions

View File

@@ -59,13 +59,7 @@ module.exports = {
reason: err
});
});
}, (err) => {
if (err) {
return cb(null, {
result: false,
reason: _.toString(err.reason)
});
}
}, () => {
var conversionResult = false,
convertedCollections = [],

View File

@@ -261,9 +261,7 @@ var sdk = require('postman-collection'),
module.exports = {
convert: function(json, options, callback) {
try {
converter.convert(json, options, (err, result) => {
callback(null, result);
});
converter.convert(json, options, callback);
}
catch (e) {
if (e instanceof OpenApiErr) {

View File

@@ -103,14 +103,14 @@ module.exports = {
getOasObject: function (file) {
let oasObj = file;
if (typeof file === 'string') {
if (typeof oasObj === 'string') {
try {
oasObj = JSON.parse(file);
oasObj = JSON.parse(oasObj);
}
catch (jsonEx) {
// Not direct JSON. Could be YAML
try {
oasObj = yaml.safeLoad(file);
oasObj = yaml.safeLoad(oasObj);
}
catch (yamlEx) {
// Not JSON or YAML