MCPcopy
hub / github.com/di-sukharev/opencommit / URLStateMachine

Function URLStateMachine

out/cli.cjs:3998–4046  ·  view source on GitHub ↗
(input, base, encodingOverride, url2, stateOverride)

Source from the content-addressed store, hash-verified

3996 return /^[A-Za-z]:$/u.test(string);
3997 }
3998 function URLStateMachine(input, base, encodingOverride, url2, stateOverride) {
3999 this.pointer = 0;
4000 this.input = input;
4001 this.base = base || null;
4002 this.encodingOverride = encodingOverride || "utf-8";
4003 this.stateOverride = stateOverride;
4004 this.url = url2;
4005 this.failure = false;
4006 this.parseError = false;
4007 if (!this.url) {
4008 this.url = {
4009 scheme: "",
4010 username: "",
4011 password: "",
4012 host: null,
4013 port: null,
4014 path: [],
4015 query: null,
4016 fragment: null
4017 };
4018 const res2 = trimControlChars(this.input);
4019 if (res2 !== this.input) {
4020 this.parseError = true;
4021 }
4022 this.input = res2;
4023 }
4024 const res = trimTabAndNewline(this.input);
4025 if (res !== this.input) {
4026 this.parseError = true;
4027 }
4028 this.input = res;
4029 this.state = stateOverride || "scheme start";
4030 this.buffer = "";
4031 this.atFlag = false;
4032 this.arrFlag = false;
4033 this.passwordTokenSeenFlag = false;
4034 this.input = Array.from(this.input, (c4) => c4.codePointAt(0));
4035 for (; this.pointer <= this.input.length; ++this.pointer) {
4036 const c4 = this.input[this.pointer];
4037 const cStr = isNaN(c4) ? void 0 : String.fromCodePoint(c4);
4038 const ret = this[`parse ${this.state}`](c4, cStr);
4039 if (!ret) {
4040 break;
4041 } else if (ret === failure) {
4042 this.failure = true;
4043 break;
4044 }
4045 }
4046 }
4047 URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c4, cStr) {
4048 if (infra.isASCIIAlpha(c4)) {
4049 this.buffer += cStr.toLowerCase();

Callers

nothing calls this directly

Calls 3

trimControlCharsFunction · 0.85
trimTabAndNewlineFunction · 0.85
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…