You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
573 B

4 years ago
  1. 'use strict';
  2. module.exports = function generate_comment(it, $keyword, $ruleType) {
  3. var out = ' ';
  4. var $schema = it.schema[$keyword];
  5. var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
  6. var $breakOnError = !it.opts.allErrors;
  7. var $comment = it.util.toQuotedString($schema);
  8. if (it.opts.$comment === true) {
  9. out += ' console.log(' + ($comment) + ');';
  10. } else if (typeof it.opts.$comment == 'function') {
  11. out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';
  12. }
  13. return out;
  14. }