({
parameters,
type
}: Partial<{
parameters: Record<any, any>
type: string | boolean | undefined
}>)
| 50 | } |
| 51 | |
| 52 | function format({ |
| 53 | parameters, |
| 54 | type |
| 55 | }: Partial<{ |
| 56 | parameters: Record<any, any> |
| 57 | type: string | boolean | undefined |
| 58 | }>) { |
| 59 | if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) throw new TypeError('invalid type') |
| 60 | |
| 61 | // start with normalized type |
| 62 | let string = String(type).toLowerCase() |
| 63 | |
| 64 | // append parameters |
| 65 | if (parameters && typeof parameters === 'object') { |
| 66 | const params = Object.keys(parameters).sort() |
| 67 | |
| 68 | for (const param of params) { |
| 69 | const val = param.substr(-1) === '*' ? ustring(parameters[param]) : qstring(parameters[param]) |
| 70 | |
| 71 | string += '; ' + param + '=' + val |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return string |
| 76 | } |
| 77 | |
| 78 | function createParams(filename?: string, fallback?: string | boolean) { |
| 79 | if (filename === undefined) return |
no test coverage detected