* @param {URL} url * @param {boolean} excludeFragment * @returns {string}
(url, excludeFragment = false)
| 138 | * @returns {string} |
| 139 | */ |
| 140 | function URLSerializer(url, excludeFragment = false) { |
| 141 | const { href } = url; |
| 142 | |
| 143 | if (!excludeFragment) { |
| 144 | return href; |
| 145 | } |
| 146 | |
| 147 | const hashLength = url.hash.length; |
| 148 | const serialized = hashLength === 0 ? href : StringPrototypeSlice(href, 0, href.length - hashLength); |
| 149 | |
| 150 | if (!hashLength && href[href.length - 1] === '#') { |
| 151 | return StringPrototypeSlice(serialized, 0, -1); |
| 152 | } |
| 153 | |
| 154 | return serialized; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * A faster collectASequenceOfCodePoints that only works when comparing a single character. |
no outgoing calls
no test coverage detected
searching dependent graphs…