Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x 10x 7x 3x 1x 2x 1x 1x | import type { FetchBody } from 'openid-client';
import {
from as URLSearchParams_from,
ish as URLSearchParams_ish
} from './URLSearchParams.js';
import { isJSONEntries, isJSONRecord } from './is.js';
export type ish =
| FetchBody
| FormData
| URLSearchParams_ish
| RequestInit['body'];
export async function from(body: ish): Promise<FetchBody | undefined> {
if (
body === undefined ||
body === null ||
typeof body === 'string' ||
body instanceof ArrayBuffer ||
body instanceof ReadableStream ||
body instanceof Uint8Array ||
body instanceof URLSearchParams
) {
return body;
} else if (isJSONRecord(body)) {
return URLSearchParams_from(body);
} else if (isJSONEntries(body)) {
return URLSearchParams_from(body);
}
return new Response(body).arrayBuffer();
}
|