@@ -25,8 +25,8 @@ export function resolveResourceFromDocsURL(link: string) {
2525// https://raw.githubusercontent.com/discord/discord-api-docs/main/docs/resources/user.mdx
2626
2727type Route = {
28- verb : string ;
2928 path : string ;
29+ verb : string ;
3030} ;
3131
3232type ParsedSection = {
@@ -43,7 +43,7 @@ function cleanLine(line: string) {
4343}
4444
4545function formatRoutePath ( path : string ) {
46- return path . replaceAll ( / \[ ( .* ?) \ ]\( .* ?\) / g, '$1' ) ;
46+ return path . replaceAll ( / \[ ( .* ?) ] \( .* ?\) / g, '$1' ) ;
4747}
4848
4949const IGNORE_LINE_PREFIXES = [ '>' , '---' , '|' , '!' ] ;
@@ -105,10 +105,10 @@ export function parseSections(content: string): ParsedSection[] {
105105 if ( line . startsWith ( '<Route' ) ) {
106106 const match = / < R o u t e m e t h o d = " (?< verb > \w { 3 , 6 } ) " > \/ (?< path > .* ) < \/ R o u t e > / . exec ( line ) ;
107107
108- if ( match ) {
108+ if ( match ?. groups ) {
109109 section . route = {
110- verb : match . groups ?. [ ' verb' ] ! ,
111- path : formatRoutePath ( match . groups ?. [ ' path' ] ! ) ,
110+ verb : match . groups . verb ! ,
111+ path : formatRoutePath ( match . groups . path ! ) ,
112112 } ;
113113 }
114114
@@ -133,7 +133,7 @@ export function findRelevantDocsSection(query: string, docsMd: string) {
133133 for ( const section of sections ) {
134134 const anchor = `#${ section . headline . toLowerCase ( ) . replaceAll ( ' ' , '-' ) . replaceAll ( ':' , '' ) } ` ;
135135
136- if ( anchor == query ) {
136+ if ( anchor === query ) {
137137 return section ;
138138 }
139139 }
0 commit comments