(query: URLSearchParams)
| 60 | } |
| 61 | |
| 62 | export 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 | |
| 72 | export function encodeOptions(options: Partial<Options>) { |
| 73 | const {maxDiffWidth, normalizeJSON, ...diffOptions} = options; |
no test coverage detected