aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-04-10 15:52:12 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-04-10 15:52:12 +0530
commit84b3a1c939dc2baf22f9f5e30029b263c1512ade (patch)
tree131f2c17ad61078f95425eab1e349b96d0245d36 /vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js
parentef9cd2561e325c82d4d1fcb03fef4582a53d7839 (diff)
Integration of VNFMarket to Main GUI
IssueId : CLIENT-189 Change-Id: I37f49f6447ba2d5fb57779754117549eb315f0b5 Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js
new file mode 100644
index 00000000..f0ed484e
--- /dev/null
+++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/har-validator/lib/runner.js
@@ -0,0 +1,29 @@
+'use strict'
+
+var schemas = require('./schemas')
+var ValidationError = require('./error')
+var validator = require('is-my-json-valid')
+
+module.exports = function (schema, data, cb) {
+ // default value
+ var valid = false
+
+ // validator config
+ var validate = validator(schema, {
+ greedy: true,
+ verbose: true,
+ schemas: schemas
+ })
+
+ // execute is-my-json-valid
+ if (data !== undefined) {
+ valid = validate(data)
+ }
+
+ // callback?
+ if (typeof cb === 'function') {
+ return cb(validate.errors ? new ValidationError(validate.errors) : null, valid)
+ }
+
+ return valid
+}