As you know jsdoc
and similar javadoc
allows describing and verification of function signatures. It allows describe possible type, enum, custom type and even possible list of values.
https://apidocjs.com#param-api-param , How to document a string type in jsdoc with limited possible values .
But I can not find example for regular comparator less than
(<
<
) or external custom function. And even more: I need not only for decimal number, but e.g. for rounded float/double too.
P.S.: You could tell me, that jsdoc is only for documentation generation and human reading and human can not read such functions, but it is wrong. There are already many solutions for auto checking by jsdoc format (e.g. like TypeScript and ESLint, but they can not check runtime wholeness and value contracts for input-output).
Simplified example of requested in runtime checking:
/**
* @param {number} height
* @param {string} firstname
* @param {string} nickname
*
* @pre height > 100 && (firstname || nickname.length >= 4)
*/
function setState (height, firstname, nickname) {
...
}