Fix parse-int to handle 2-arg form (value + default)
cssx-resolve calls (parse-int "699" nil) — the 2-arg form was falling to the catch-all and returning Nil, causing colour tokens like text-violet-699 to not generate CSS rules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -633,7 +633,10 @@ let make_server_env () =
|
||||
bind "parse-int" (fun args ->
|
||||
match args with
|
||||
| [String s] -> (try Number (float_of_int (int_of_string s)) with _ -> Nil)
|
||||
| [Number n] -> Number (Float.round n)
|
||||
| [String s; default_val] ->
|
||||
(try Number (float_of_int (int_of_string s)) with _ -> default_val)
|
||||
| [Number n] | [Number n; _] -> Number (Float.round n)
|
||||
| [_; default_val] -> default_val
|
||||
| _ -> Nil);
|
||||
|
||||
bind "json-encode" (fun args -> io_request "helper" (String "json-encode" :: args));
|
||||
|
||||
Reference in New Issue
Block a user