]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/example.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / request / node_modules / har-validator / node_modules / is-my-json-valid / example.js
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/example.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/example.js
new file mode 100644 (file)
index 0000000..f70f4df
--- /dev/null
@@ -0,0 +1,18 @@
+var validator = require('./')
+
+var validate = validator({
+  type: 'object',
+  properties: {
+    hello: {
+      required: true,
+      type: 'string'
+    }
+  }
+})
+
+console.log('should be valid', validate({hello: 'world'}))
+console.log('should not be valid', validate({}))
+
+// get the last error message by checking validate.error
+// the following will print "data.hello is required"
+console.log('the errors were:', validate.errors)