MCPcopy Create free account
hub / github.com/angular/dev-infra / simpleRangeHeaderValue

Function simpleRangeHeaderValue

github-actions/saucelabs/set-saucelabs-env.js:4831–4901  ·  view source on GitHub ↗
(value, allowWhitespace)

Source from the content-addressed store, hash-verified

4829 }
4830 function urlHasHttpsScheme(url) {
4831 return typeof url === "string" && url[5] === ":" && url[0] === "h" && url[1] === "t" && url[2] === "t" && url[3] === "p" && url[4] === "s" || url.protocol === "https:";
4832 }
4833 function urlIsHttpHttpsScheme(url) {
4834 assert("protocol" in url);
4835 const protocol = url.protocol;
4836 return protocol === "http:" || protocol === "https:";
4837 }
4838 function simpleRangeHeaderValue(value, allowWhitespace) {
4839 const data = value;
4840 if (!data.startsWith("bytes")) {
4841 return "failure";
4842 }
4843 const position = { position: 5 };
4844 if (allowWhitespace) {
4845 collectASequenceOfCodePoints(
4846 (char) => char === " " || char === " ",
4847 data,
4848 position
4849 );
4850 }
4851 if (data.charCodeAt(position.position) !== 61) {
4852 return "failure";
4853 }
4854 position.position++;
4855 if (allowWhitespace) {
4856 collectASequenceOfCodePoints(
4857 (char) => char === " " || char === " ",
4858 data,
4859 position
4860 );
4861 }
4862 const rangeStart = collectASequenceOfCodePoints(
4863 (char) => {
4864 const code = char.charCodeAt(0);
4865 return code >= 48 && code <= 57;
4866 },
4867 data,
4868 position
4869 );
4870 const rangeStartValue = rangeStart.length ? Number(rangeStart) : null;
4871 if (allowWhitespace) {
4872 collectASequenceOfCodePoints(
4873 (char) => char === " " || char === " ",
4874 data,
4875 position
4876 );
4877 }
4878 if (data.charCodeAt(position.position) !== 45) {
4879 return "failure";
4880 }
4881 position.position++;
4882 if (allowWhitespace) {
4883 collectASequenceOfCodePoints(
4884 (char) => char === " " || char === " ",
4885 data,
4886 position
4887 );
4888 }

Callers 1

schemeFetchFunction · 0.70

Calls 1

Tested by

no test coverage detected