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

Method parseLine

github-actions/browserstack/set-browserstack-env.js:18824–18870  ·  view source on GitHub ↗

* @param {Buffer} line * @param {EventStreamEvent} event

(line, event)

Source from the content-addressed store, hash-verified

18822 }
18823 if (this.buffer) {
18824 this.buffer = Buffer.concat([this.buffer, chunk]);
18825 } else {
18826 this.buffer = chunk;
18827 }
18828 if (this.checkBOM) {
18829 switch (this.buffer.length) {
18830 case 1:
18831 if (this.buffer[0] === BOM[0]) {
18832 callback();
18833 return;
18834 }
18835 this.checkBOM = false;
18836 callback();
18837 return;
18838 case 2:
18839 if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1]) {
18840 callback();
18841 return;
18842 }
18843 this.checkBOM = false;
18844 break;
18845 case 3:
18846 if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1] && this.buffer[2] === BOM[2]) {
18847 this.buffer = Buffer.alloc(0);
18848 this.checkBOM = false;
18849 callback();
18850 return;
18851 }
18852 this.checkBOM = false;
18853 break;
18854 default:
18855 if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1] && this.buffer[2] === BOM[2]) {
18856 this.buffer = this.buffer.subarray(3);
18857 }
18858 this.checkBOM = false;
18859 break;
18860 }
18861 }
18862 while (this.pos < this.buffer.length) {
18863 if (this.eventEndCheck) {
18864 if (this.crlfCheck) {
18865 if (this.buffer[this.pos] === LF) {
18866 this.buffer = this.buffer.subarray(this.pos + 1);
18867 this.pos = 0;
18868 this.crlfCheck = false;
18869 continue;
18870 }
18871 this.crlfCheck = false;
18872 }
18873 if (this.buffer[this.pos] === LF || this.buffer[this.pos] === CR) {

Callers 1

_transformMethod · 0.45

Calls 3

isASCIINumberFunction · 0.70
isValidLastEventIdFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected