MCPcopy Create free account
hub / github.com/denoland/std / toJSON

Method toJSON

http/user_agent.ts:1157–1167  ·  view source on GitHub ↗

* Converts the current instance to a JSON representation. * * @example Usage * ```ts ignore * import { UserAgent } from "@std/http/user-agent"; * * Deno.serve((req) => { * const userAgent = new UserAgent(req.headers.get("user-agent") ?? ""); * return new Response(`Hello,

()

Source from the content-addressed store, hash-verified

1155 * @returns A JSON representation on this user agent instance.
1156 */
1157 toJSON(): {
1158 browser: Browser;
1159 cpu: Cpu;
1160 device: Device;
1161 engine: Engine;
1162 os: Os;
1163 ua: string;
1164 } {
1165 const { browser, cpu, device, engine, os, ua } = this;
1166 return { browser, cpu, device, engine, os, ua };
1167 }
1168
1169 /**
1170 * Converts the current instance to a string.

Callers 3

user_agent_test.tsFile · 0.45
calcFileInfoFunction · 0.45
fnFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected