|
1 | 1 | <% |
2 | 2 | const { data, utils } = it; |
3 | | -const { formatDescription, require, _ } = utils; |
| 3 | +const { formatDescription, escapeJSDocContent, require, _ } = utils; |
4 | 4 |
|
5 | 5 | const stringify = (value) => _.isObject(value) ? JSON.stringify(value) : _.isString(value) ? `"${value}"` : value; |
6 | 6 |
|
7 | 7 | const jsDocLines = _.compact([ |
8 | | - data.title, |
| 8 | + data.title && formatDescription(data.title), |
9 | 9 | data.description && formatDescription(data.description), |
10 | 10 | !_.isUndefined(data.deprecated) && data.deprecated && '@deprecated', |
11 | | - !_.isUndefined(data.format) && `@format ${data.format}`, |
12 | | - !_.isUndefined(data.minimum) && `@min ${data.minimum}`, |
13 | | - !_.isUndefined(data.multipleOf) && `@multipleOf ${data.multipleOf}`, |
14 | | - !_.isUndefined(data.exclusiveMinimum) && `@exclusiveMin ${data.exclusiveMinimum}`, |
15 | | - !_.isUndefined(data.maximum) && `@max ${data.maximum}`, |
16 | | - !_.isUndefined(data.minLength) && `@minLength ${data.minLength}`, |
17 | | - !_.isUndefined(data.maxLength) && `@maxLength ${data.maxLength}`, |
18 | | - !_.isUndefined(data.exclusiveMaximum) && `@exclusiveMax ${data.exclusiveMaximum}`, |
19 | | - !_.isUndefined(data.maxItems) && `@maxItems ${data.maxItems}`, |
20 | | - !_.isUndefined(data.minItems) && `@minItems ${data.minItems}`, |
21 | | - !_.isUndefined(data.uniqueItems) && `@uniqueItems ${data.uniqueItems}`, |
22 | | - !_.isUndefined(data.default) && `@default ${stringify(data.default)}`, |
23 | | - !_.isUndefined(data.pattern) && `@pattern ${data.pattern}`, |
24 | | - !_.isUndefined(data.example) && `@example ${stringify(data.example)}` |
| 11 | + !_.isUndefined(data.format) && `@format ${escapeJSDocContent(data.format)}`, |
| 12 | + !_.isUndefined(data.minimum) && `@min ${escapeJSDocContent(data.minimum)}`, |
| 13 | + !_.isUndefined(data.multipleOf) && `@multipleOf ${escapeJSDocContent(data.multipleOf)}`, |
| 14 | + !_.isUndefined(data.exclusiveMinimum) && `@exclusiveMin ${escapeJSDocContent(data.exclusiveMinimum)}`, |
| 15 | + !_.isUndefined(data.maximum) && `@max ${escapeJSDocContent(data.maximum)}`, |
| 16 | + !_.isUndefined(data.minLength) && `@minLength ${escapeJSDocContent(data.minLength)}`, |
| 17 | + !_.isUndefined(data.maxLength) && `@maxLength ${escapeJSDocContent(data.maxLength)}`, |
| 18 | + !_.isUndefined(data.exclusiveMaximum) && `@exclusiveMax ${escapeJSDocContent(data.exclusiveMaximum)}`, |
| 19 | + !_.isUndefined(data.maxItems) && `@maxItems ${escapeJSDocContent(data.maxItems)}`, |
| 20 | + !_.isUndefined(data.minItems) && `@minItems ${escapeJSDocContent(data.minItems)}`, |
| 21 | + !_.isUndefined(data.uniqueItems) && `@uniqueItems ${escapeJSDocContent(data.uniqueItems)}`, |
| 22 | + !_.isUndefined(data.default) && `@default ${escapeJSDocContent(stringify(data.default))}`, |
| 23 | + !_.isUndefined(data.pattern) && `@pattern ${escapeJSDocContent(data.pattern)}`, |
| 24 | + !_.isUndefined(data.example) && `@example ${escapeJSDocContent(stringify(data.example))}` |
25 | 25 | ]).join('\n').split('\n'); |
26 | 26 | %> |
27 | 27 | <% if (jsDocLines.every(_.isEmpty)) { %> |
|
0 commit comments