MCPcopy Index your code
hub / github.com/tinyhttp/tinyhttp / acceptParams

Function acceptParams

packages/res/src/util.ts:6–17  ·  view source on GitHub ↗
(str: string, index?: number)

Source from the content-addressed store, hash-verified

4 ~type.indexOf('/') ? acceptParams(type) : { value: mime.lookup(type), params: {} }
5
6export function acceptParams(str: string, index?: number) {
7 const parts = str.split(/ *; */)
8 const ret = { value: parts[0], quality: 1, params: {}, originalIndex: index }
9
10 for (const part of parts) {
11 const pms = part.split(/ *= */)
12 if ('q' === pms[0]) ret.quality = parseFloat(pms[1])
13 else ret.params[pms[0]] = pms[1]
14 }
15
16 return ret
17}
18
19export function normalizeTypes(types: string[]) {
20 const ret = []

Callers 1

normalizeTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected