Cleanup js -> string

Converting a JS value to a string is a bit messy right now. There's duplication
between string helpers in js.Local, and what js.String and js.Value provide.

Now, all stringifying functions are in js.String, with some helpers in js.Value.

Also tried to streamline the APIs around most common-cases (e.g. js.String ->
[]u8 using call_arena). js.String now also implements format, so it can be
used as-is in some cases.
This commit is contained in:
Karl Seguin
2026-01-29 14:21:24 +08:00
parent 232e7a1759
commit c84106570f
18 changed files with 173 additions and 205 deletions

View File

@@ -140,7 +140,7 @@ fn run(
return err;
};
return value.toString(.{ .allocator = arena });
return value.toStringSliceWithAlloc(arena);
}
const Writer = struct {