* Create a ContentType instance from a header value. If the value has been * previously parsed, the cached instance will be returned. * @param {string} headerValue * @returns {ContentType | undefined}
(headerValue)
| 71 | * @returns {ContentType | undefined} |
| 72 | */ |
| 73 | static from (headerValue) { |
| 74 | let contentType = cache.get(headerValue) |
| 75 | if (contentType !== undefined) return contentType |
| 76 | contentType = new ContentType(headerValue) |
| 77 | cache.set(headerValue, contentType) |
| 78 | return contentType |
| 79 | } |
| 80 | |
| 81 | constructor (headerValue) { |
| 82 | if (headerValue == null || headerValue === '' || headerValue === 'undefined') { |
no outgoing calls