diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/index.js')
-rw-r--r-- | vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/index.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/index.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/index.js new file mode 100644 index 00000000..e8351b8d --- /dev/null +++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/index.js @@ -0,0 +1,22 @@ +'use strict' + +var Promise = require('pinkie-promise') +var runner = require('./runner') +var schemas = require('./schemas') + +var promisify = function (schema) { + return function (data) { + return new Promise(function (resolve, reject) { + runner(schema, data, function (err, valid) { + return err === null ? resolve(data) : reject(err) + }) + }) + } +} + +module.exports = promisify(schemas.har) + +// utility methods for all parts of the schema +Object.keys(schemas).map(function (name) { + module.exports[name] = promisify(schemas[name]) +}) |