(options: ProblemDocumentOptions, extension?: ProblemDocumentExtension | Record<string, Object>)
| 9 | public type?: string |
| 10 | |
| 11 | public constructor (options: ProblemDocumentOptions, extension?: ProblemDocumentExtension | Record<string, Object>) { |
| 12 | const detail = options.detail |
| 13 | const instance = options.instance |
| 14 | let type = options.type |
| 15 | let title = options.title |
| 16 | const status = options.status |
| 17 | |
| 18 | if (status && !type) { |
| 19 | type = 'about:blank' |
| 20 | } |
| 21 | |
| 22 | if (status && type === 'about:blank') { |
| 23 | title = statusCodes[status] |
| 24 | } |
| 25 | |
| 26 | if (instance) { |
| 27 | // eslint-disable-next-line node/no-deprecated-api |
| 28 | url.parse(instance) |
| 29 | } |
| 30 | |
| 31 | if (type) { |
| 32 | // eslint-disable-next-line node/no-deprecated-api |
| 33 | url.parse(type) |
| 34 | // eslint-disable-next-line node/no-deprecated-api |
| 35 | } |
| 36 | |
| 37 | // const result = { |
| 38 | this.type = type |
| 39 | this.title = title |
| 40 | if (detail) { |
| 41 | this.detail = detail |
| 42 | } |
| 43 | this.instance = instance |
| 44 | this.status = status |
| 45 | // }; |
| 46 | |
| 47 | if (extension) { |
| 48 | const extensionProperties = extension instanceof ProblemDocumentExtension |
| 49 | ? extension.extensionProperties |
| 50 | : extension |
| 51 | |
| 52 | for (const propertyName in extensionProperties) { |
| 53 | if (extensionProperties.hasOwnProperty(propertyName)) { |
| 54 | this[propertyName] = extensionProperties[propertyName] |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | export class ProblemDocumentOptions { |
nothing calls this directly
no outgoing calls
no test coverage detected