MCPcopy
hub / github.com/nestjs/swagger / parseCommentDocValue

Function parseCommentDocValue

lib/plugin/utils/ast-utils.ts:156–173  ·  view source on GitHub ↗
(docValue: string, type: ts.Type)

Source from the content-addressed store, hash-verified

154}
155
156export function parseCommentDocValue(docValue: string, type: ts.Type) {
157 let value = docValue.replace(/'/g, '"').trim();
158
159 if (!type || !isString(type)) {
160 try {
161 value = JSON.parse(value);
162 } catch {
163 // Do nothing
164 }
165 } else if (isString(type)) {
166 if (value.split(' ').length !== 1 && !value.startsWith('"')) {
167 value = null;
168 } else {
169 value = value.replace(/"/g, '');
170 }
171 }
172 return value;
173}
174
175export function getTsDocTagsOfNode(node: Node, typeChecker: TypeChecker) {
176 const docComment = getDocComment(node);

Callers 1

introspectTsDocTagsFunction · 0.85

Calls 1

isStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…