| 139 | } |
| 140 | |
| 141 | get(header, parser) { |
| 142 | header = normalizeHeader(header); |
| 143 | |
| 144 | if (header) { |
| 145 | const key = utils.findKey(this, header); |
| 146 | |
| 147 | if (key) { |
| 148 | const value = this[key]; |
| 149 | |
| 150 | if (!parser) { |
| 151 | return value; |
| 152 | } |
| 153 | |
| 154 | if (parser === true) { |
| 155 | return parseTokens(value); |
| 156 | } |
| 157 | |
| 158 | if (utils.isFunction(parser)) { |
| 159 | return parser.call(this, value, key); |
| 160 | } |
| 161 | |
| 162 | if (utils.isRegExp(parser)) { |
| 163 | return parser.exec(value); |
| 164 | } |
| 165 | |
| 166 | throw new TypeError(class="st">'parser must be boolean|regexp|function'); |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | has(header, matcher) { |
| 172 | header = normalizeHeader(header); |