ÿØÿà JFIF ÿá Exif MM * ÿÛ C
Server IP : 199.250.214.225 / Your IP : 18.225.98.177 Web Server : Apache System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : nicngo5 ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/nicngo5/nicnwebsiteUpgrade/node_modules/vue/src/compiler/ |
Upload File : |
/* @flow */ const range = 2 export function generateCodeFrame ( source: string, start: number = 0, end: number = source.length ): string { const lines = source.split(/\r?\n/) let count = 0 const res = [] for (let i = 0; i < lines.length; i++) { count += lines[i].length + 1 if (count >= start) { for (let j = i - range; j <= i + range || end > count; j++) { if (j < 0 || j >= lines.length) continue res.push(`${j + 1}${repeat(` `, 3 - String(j + 1).length)}| ${lines[j]}`) const lineLength = lines[j].length if (j === i) { // push underline const pad = start - (count - lineLength) + 1 const length = end > count ? lineLength - pad : end - start res.push(` | ` + repeat(` `, pad) + repeat(`^`, length)) } else if (j > i) { if (end > count) { const length = Math.min(end - count, lineLength) res.push(` | ` + repeat(`^`, length)) } count += lineLength + 1 } } break } } return res.join('\n') } function repeat (str, n) { let result = '' if (n > 0) { while (true) { // eslint-disable-line if (n & 1) result += str n >>>= 1 if (n <= 0) break str += str } } return result }