(value, allowWhitespace)
| 5802 | } |
| 5803 | __name(urlIsHttpHttpsScheme, "urlIsHttpHttpsScheme"); |
| 5804 | function simpleRangeHeaderValue(value, allowWhitespace) { |
| 5805 | const data = value; |
| 5806 | if (!data.startsWith("bytes")) { |
| 5807 | return "failure"; |
| 5808 | } |
| 5809 | const position = { position: 5 }; |
| 5810 | if (allowWhitespace) { |
| 5811 | collectASequenceOfCodePoints( |
| 5812 | (char) => char === " " || char === " ", |
| 5813 | data, |
| 5814 | position |
| 5815 | ); |
| 5816 | } |
| 5817 | if (data.charCodeAt(position.position) !== 61) { |
| 5818 | return "failure"; |
| 5819 | } |
| 5820 | position.position++; |
| 5821 | if (allowWhitespace) { |
| 5822 | collectASequenceOfCodePoints( |
| 5823 | (char) => char === " " || char === " ", |
| 5824 | data, |
| 5825 | position |
| 5826 | ); |
| 5827 | } |
| 5828 | const rangeStart = collectASequenceOfCodePoints( |
| 5829 | (char) => { |
| 5830 | const code = char.charCodeAt(0); |
| 5831 | return code >= 48 && code <= 57; |
| 5832 | }, |
| 5833 | data, |
| 5834 | position |
| 5835 | ); |
| 5836 | const rangeStartValue = rangeStart.length ? Number(rangeStart) : null; |
| 5837 | if (allowWhitespace) { |
| 5838 | collectASequenceOfCodePoints( |
| 5839 | (char) => char === " " || char === " ", |
| 5840 | data, |
| 5841 | position |
| 5842 | ); |
| 5843 | } |
| 5844 | if (data.charCodeAt(position.position) !== 45) { |
| 5845 | return "failure"; |
| 5846 | } |
| 5847 | position.position++; |
| 5848 | if (allowWhitespace) { |
| 5849 | collectASequenceOfCodePoints( |
| 5850 | (char) => char === " " || char === " ", |
| 5851 | data, |
| 5852 | position |
| 5853 | ); |
| 5854 | } |
| 5855 | const rangeEnd = collectASequenceOfCodePoints( |
| 5856 | (char) => { |
| 5857 | const code = char.charCodeAt(0); |
| 5858 | return code >= 48 && code <= 57; |
| 5859 | }, |
| 5860 | data, |
| 5861 | position |
no test coverage detected
searching dependent graphs…