typia
Version:
Superfast runtime validators with only one line
16 lines (13 loc) • 637 B
JavaScript
import { CommentFactory } from '../../factories/CommentFactory.mjs';
const json_schema_title = (schema) => {
const info = schema.jsDocTags?.find((tag) => tag.name === "title");
if (info?.text?.length)
return CommentFactory.merge(info.text);
else if (!schema.description?.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;
};
export { json_schema_title };
//# sourceMappingURL=json_schema_title.mjs.map