Blame view

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