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,
|
2023-03-08 06:44:54 -05:00
|
|
|
} from "ext:deno_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;
|