fix(codemode): use Bun's wording for the missing atob/btoa argument (#48381)

This commit is contained in:
Aiden Cline
2026-09-10 20:08:36 -05:00
committed by GitHub
Unverified
parent 9b1891fb7e
commit 181428a2f3
+2 -3
View File
@@ -5,9 +5,8 @@ import { coerceToString } from "./value.js"
// WebIDL DOMString conversion: a missing argument is a TypeError, anything else stringifies.
const base64 = (name: "atob" | "btoa") =>
sync(name, (args, node) => {
if (args.length === 0) {
throw new InterpreterRuntimeError(`${name} requires 1 argument, but only 0 were provided.`, node).as("TypeError")
}
if (args.length === 0)
throw new InterpreterRuntimeError(`${name} requires 1 argument (a string)`, node).as("TypeError")
const input = coerceToString(args[0])
try {
return name === "atob" ? atob(input) : btoa(input)