Unquote a TS `string` literal node and root it at "/": Nest writes route * segments without a leading slash (@Get(':id'), @Controller('users')). */
| 3248 | /* Unquote a TS `string` literal node and root it at "/": Nest writes route |
| 3249 | * segments without a leading slash (@Get(':id'), @Controller('users')). */ |
| 3250 | static const char *nest_path_from_string(CBMArena *a, TSNode node, const char *source) { |
| 3251 | if (ts_node_is_null(node) || strcmp(ts_node_type(node), "string") != 0) { |
| 3252 | return NULL; |
| 3253 | } |
| 3254 | char *text = cbm_node_text(a, node, source); |
| 3255 | size_t len = text ? strlen(text) : 0; |
| 3256 | if (len < PAIR_CHARS) { |
| 3257 | return NULL; |
| 3258 | } |
| 3259 | const char *inner = cbm_arena_strndup(a, text + SKIP_CHAR, len - PAIR_CHARS); |
| 3260 | if (!inner) { |
| 3261 | return NULL; |
| 3262 | } |
| 3263 | return inner[0] == '/' ? inner : cbm_arena_sprintf(a, "/%s", inner); |
| 3264 | } |
| 3265 | |
| 3266 | /* The route path a Nest decorator's argument list carries. Accepted shapes: |
| 3267 | * () -> "/" |
no test coverage detected