Skip to content

Commit

Permalink
Fix schema check function
Browse files Browse the repository at this point in the history
  • Loading branch information
josei committed Nov 8, 2018
1 parent e13ad67 commit afd5c77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/contents/reference/schema.rst
Expand Up @@ -84,7 +84,7 @@ The function used by verifiers to check that an app's output fits its schema is
.. code::
function checkSchema(data, schema) {
if (typeof(schema) == 'number') {
if (typeof(schema) === 'number') {
if (JSON.stringify(data).length > schema) {
return false;
}
Expand All @@ -101,11 +101,11 @@ The function used by verifiers to check that an app's output fits its schema is
}
}
} else {
if (typeof(data) != 'object') {
if (typeof(data) !== 'object') {
return false;
}
for (let key in data) {
if (Object.keys(schema).indexOf(key) == -1) {
if (Object.keys(schema).indexOf(key) === -1) {
return false;
}
if (!checkSchema(data[key], schema[key])) {
Expand Down

0 comments on commit afd5c77

Please sign in to comment.