* Move the "slow cases" to a separate function to make sure this function gets * inlined properly. That prioritizes the common case. * @param {unknown} enc * @returns {string | undefined} Returns undefined if there is no match.
(enc)
| 256 | * @returns {string | undefined} Returns undefined if there is no match. |
| 257 | */ |
| 258 | function normalizeEncoding(enc) { |
| 259 | if (enc == null || enc === 'utf8' || enc === 'utf-8') return 'utf8'; |
| 260 | return slowCases(enc); |
| 261 | } |
| 262 | |
| 263 | function slowCases(enc) { |
| 264 | switch (enc.length) { |
no test coverage detected
searching dependent graphs…