forked from postmanlabs/har-to-postman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (31 loc) · 742 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const {
SchemaPack
} = require('./lib/SchemaPack.js');
module.exports = {
convert: function (input, options, cb) {
let schema;
try {
schema = new SchemaPack(input, options);
}
catch (error) {
return cb(error);
}
if (schema.validationResult.result) {
return schema.convert(cb);
}
return cb(null, schema.validationResult);
},
validate: function (input) {
const schema = new SchemaPack(input);
return schema.validationResult;
},
getMetaData: function (input, cb) {
const schema = new SchemaPack(input);
schema.getMetaData(cb);
},
getOptions: function (mode, criteria) {
return SchemaPack.getOptions(mode, criteria);
},
SchemaPack
};