????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.16.24.18 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/forge/node_modules/eslint/lib/util/ |
Upload File : |
/** * @fileoverview Tracks performance of individual rules. * @author Brandon Mills */ "use strict"; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ /* istanbul ignore next */ /** * Align the string to left * @param {string} str string to evaluate * @param {int} len length of the string * @param {string} ch delimiter character * @returns {string} modified string * @private */ function alignLeft(str, len, ch) { return str + new Array(len - str.length + 1).join(ch || " "); } /* istanbul ignore next */ /** * Align the string to right * @param {string} str string to evaluate * @param {int} len length of the string * @param {string} ch delimiter character * @returns {string} modified string * @private */ function alignRight(str, len, ch) { return new Array(len - str.length + 1).join(ch || " ") + str; } //------------------------------------------------------------------------------ // Module definition //------------------------------------------------------------------------------ const enabled = !!process.env.TIMING; const HEADERS = ["Rule", "Time (ms)", "Relative"]; const ALIGN = [alignLeft, alignRight, alignRight]; /* istanbul ignore next */ /** * display the data * @param {Object} data Data object to be displayed * @returns {string} modified string * @private */ function display(data) { let total = 0; const rows = Object.keys(data) .map(key => { const time = data[key]; total += time; return [key, time]; }) .sort((a, b) => b[1] - a[1]) .slice(0, 10); rows.forEach(row => { row.push(`${(row[1] * 100 / total).toFixed(1)}%`); row[1] = row[1].toFixed(3); }); rows.unshift(HEADERS); const widths = []; rows.forEach(row => { const len = row.length; for (let i = 0; i < len; i++) { const n = row[i].length; if (!widths[i] || n > widths[i]) { widths[i] = n; } } }); const table = rows.map(row => ( row .map((cell, index) => ALIGN[index](cell, widths[index])) .join(" | ") )); table.splice(1, 0, widths.map((width, index) => { const extraAlignment = index !== 0 && index !== widths.length - 1 ? 2 : 1; return ALIGN[index](":", width + extraAlignment, "-"); }).join("|")); console.log(table.join("\n")); // eslint-disable-line no-console } /* istanbul ignore next */ module.exports = (function() { const data = Object.create(null); /** * Time the run * @param {*} key key from the data object * @param {Function} fn function to be called * @returns {Function} function to be executed * @private */ function time(key, fn) { if (typeof data[key] === "undefined") { data[key] = 0; } return function(...args) { let t = process.hrtime(); fn(...args); t = process.hrtime(t); data[key] += t[0] * 1e3 + t[1] / 1e6; }; } if (enabled) { process.on("exit", () => { display(data); }); } return { time, enabled }; }());