Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web-console/script/create-sql-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const snarkdown = require('snarkdown');

const writefile = 'lib/sql-docs.js';

const MINIMUM_EXPECTED_NUMBER_OF_FUNCTIONS = 158;
const MINIMUM_EXPECTED_NUMBER_OF_FUNCTIONS = 162;
const MINIMUM_EXPECTED_NUMBER_OF_DATA_TYPES = 14;

function hasHtmlTags(str) {
Expand Down Expand Up @@ -90,15 +90,15 @@ const readDoc = async () => {

// Make sure there are enough functions found
const numFunction = Object.keys(functionDocs).length;
if (numFunction < MINIMUM_EXPECTED_NUMBER_OF_FUNCTIONS) {
if (!(MINIMUM_EXPECTED_NUMBER_OF_FUNCTIONS <= numFunction)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this some weird js quirk? How is this different from the original numFunc < MIN_EXPECTED condition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they behave differently if numFunctions is undefined because all comparisons with undefined are always false:

image

throw new Error(
`Did not find enough function entries did the structure of '${readfile}' change? (found ${numFunction} but expected at least ${MINIMUM_EXPECTED_NUMBER_OF_FUNCTIONS})`,
);
}

// Make sure there are at least 10 data types for sanity
const numDataTypes = dataTypeDocs.length;
if (numDataTypes < MINIMUM_EXPECTED_NUMBER_OF_DATA_TYPES) {
const numDataTypes = Object.keys(dataTypeDocs).length;
if (!(MINIMUM_EXPECTED_NUMBER_OF_DATA_TYPES <= numDataTypes)) {
throw new Error(
`Did not find enough data type entries did the structure of '${readfile}' change? (found ${numDataTypes} but expected at least ${MINIMUM_EXPECTED_NUMBER_OF_DATA_TYPES})`,
);
Expand Down