MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parseStringField

Function parseStringField

src/resolution/frameworks/nestjs.ts:971–975  ·  view source on GitHub ↗

* Read a string-valued field — `key: 'value'` — out of one object literal's * body. Returns `''` if not present. The leading character class guards * against matching a field whose name *contains* the target as a suffix.

(obj: string, name: string)

Source from the content-addressed store, hash-verified

969 * against matching a field whose name *contains* the target as a suffix.
970 */
971function parseStringField(obj: string, name: string): string {
972 const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*['"\`]([^'"\`]*)['"\`]`);
973 const m = obj.match(re);
974 return m ? m[1]! : '';
975}
976
977/** Read an identifier-valued field — `key: SomeIdent` — out of one object body. */
978function parseIdentField(obj: string, name: string): string | null {

Callers 1

parseRouteObjectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected