MCPcopy Create free account
hub / github.com/danvk/webdiff / parseOptions

Function parseOptions

ts/options.ts:62–70  ·  view source on GitHub ↗
(query: URLSearchParams)

Source from the content-addressed store, hash-verified

60}
61
62export function parseOptions(query: URLSearchParams): Partial<Options> {
63 const flags = query.getAll('flag');
64 const gitDiffOptions = flagsToGitDiffOptions(flags);
65 const maxWidthStr = query.get('width');
66 const maxDiffWidth = maxWidthStr ? {maxDiffWidth: Number(maxWidthStr)} : undefined;
67 const normalizeJsonStr = query.get('normalize_json');
68 const normalizeJSON = normalizeJsonStr ? {normalizeJSON: true} : undefined;
69 return {...gitDiffOptions, ...maxDiffWidth, ...normalizeJSON};
70}
71
72export function encodeOptions(options: Partial<Options>) {
73 const {maxDiffWidth, normalizeJSON, ...diffOptions} = options;

Callers 1

RootFunction · 0.90

Calls 1

flagsToGitDiffOptionsFunction · 0.90

Tested by

no test coverage detected