MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / applyScope

Function applyScope

beautify/script.ts:2050–2086  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2048 let s:number = scopes.length,
2049 t:number = 0;
2050 const applyScope = function beautify_script_output_reference_applyScope():void {
2051 // applyScope function exists to prevent presenting spaces as part of reference names if option 'vertical' is set to true
2052 let token:string = data.token[a],
2053 space:string = "";
2054 const spaceIndex:number = token.indexOf(" "),
2055 scopeValue:string = (function beautify_script_output_reference_applyScope_scopeValue():string {
2056 let begin:number = data.begin[scopes[s][1]],
2057 value:string = "";
2058 if (scopes[s][1] < 0 || begin < 0) {
2059 return "0";
2060 }
2061 if (data.token[scopes[s][1]] !== undefined && data.token[scopes[s][1]].indexOf("<em") === 0) {
2062 begin = scopes[s][1];
2063 } else if (data.token[begin] === undefined || data.token[begin].indexOf("<em") !== 0) {
2064 do {
2065 begin = data.begin[begin];
2066 } while (begin > 0 && data.token[begin].indexOf("<em") !== 0);
2067 }
2068 if (begin < 0) {
2069 value = "0";
2070 } else {
2071 value = data.token[begin];
2072 value = value.slice(value.indexOf("class=") + 8);
2073 value = value.slice(0, value.indexOf(">") - 1);
2074 }
2075 if (data.stack[a] === "arguments" || data.stack[scopes[s][1]] === "arguments") {
2076 return String(Number(value) + 1);
2077 }
2078 return value;
2079 }());
2080 if (spaceIndex > 0) {
2081 space = token.slice(spaceIndex);
2082 token = token.slice(0, spaceIndex);
2083 }
2084 data.token[a] = `prettydiffltem class="s${scopeValue}"prettydiffgt${token}prettydifflt/emprettydiffgt${space}`;
2085 build.push(data.token[a]);
2086 };
2087 if (scopes.length < 1) {
2088 return;
2089 }

Callers 1

referenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected