@matatbread/typia
Version:
Superfast runtime validators with only one line
17 lines • 982 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.json_schema_title = void 0;
const CommentFactory_1 = require("../../factories/CommentFactory");
const json_schema_title = (schema) => {
var _a, _b, _c;
const info = (_a = schema.jsDocTags) === null || _a === void 0 ? void 0 : _a.find((tag) => tag.name === "title");
if ((_b = info === null || info === void 0 ? void 0 : info.text) === null || _b === void 0 ? void 0 : _b.length)
return CommentFactory_1.CommentFactory.merge(info.text);
else if (!((_c = schema.description) === null || _c === void 0 ? void 0 : _c.length))
return undefined;
const index = schema.description.indexOf("\n");
const top = (index === -1 ? schema.description : schema.description.substring(0, index)).trim();
return top.endsWith(".") ? top.substring(0, top.length - 1) : undefined;
};
exports.json_schema_title = json_schema_title;
//# sourceMappingURL=json_schema_title.js.map