2023-01-15 08:36:12 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
// deno-lint-ignore-file
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
import {
|
|
|
|
converters,
|
|
|
|
createDictionaryConverter,
|
|
|
|
} from "internal:ext/webidl/00_webidl.js";
|
2023-01-15 08:36:12 -05:00
|
|
|
|
|
|
|
const TextDecodeOptions = createDictionaryConverter(
|
|
|
|
"TextDecodeOptions",
|
|
|
|
[
|
|
|
|
{
|
|
|
|
key: "stream",
|
|
|
|
converter: converters.boolean,
|
|
|
|
defaultValue: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
globalThis.TextDecodeOptions = TextDecodeOptions;
|
2023-01-15 08:36:12 -05:00
|
|
|
|
|
|
|
// Sanity check
|
|
|
|
{
|
|
|
|
const o = TextDecodeOptions(undefined);
|
|
|
|
if (o.stream !== false) {
|
|
|
|
throw new Error("Unexpected stream value");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handwrittenConverter(V) {
|
|
|
|
const defaultValue = { stream: false };
|
|
|
|
if (V === undefined || V === null) {
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
if (V.stream !== undefined) {
|
|
|
|
defaultValue.stream = !!V.stream;
|
|
|
|
}
|
|
|
|
return defaultValue;
|
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
globalThis.handwrittenConverter = handwrittenConverter;
|