feat: refactoring project
This commit is contained in:
15
node_modules/webpack/lib/logging/truncateArgs.js
generated
vendored
15
node_modules/webpack/lib/logging/truncateArgs.js
generated
vendored
@@ -16,7 +16,7 @@ const arraySum = array => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {any[]} args items to be truncated
|
||||
* @param {EXPECTED_ANY[]} args items to be truncated
|
||||
* @param {number} maxLength maximum length of args including spaces between
|
||||
* @returns {string[]} truncated args
|
||||
*/
|
||||
@@ -28,17 +28,15 @@ const truncateArgs = (args, maxLength) => {
|
||||
if (availableLength >= args[0].length) {
|
||||
return args;
|
||||
} else if (availableLength > 3) {
|
||||
return ["..." + args[0].slice(-availableLength + 3)];
|
||||
} else {
|
||||
return [args[0].slice(-availableLength)];
|
||||
return [`...${args[0].slice(-availableLength + 3)}`];
|
||||
}
|
||||
return [args[0].slice(-availableLength)];
|
||||
}
|
||||
|
||||
// Check if there is space for at least 4 chars per arg
|
||||
if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) {
|
||||
// remove args
|
||||
if (args.length > 1)
|
||||
return truncateArgs(args.slice(0, args.length - 1), maxLength);
|
||||
if (args.length > 1) return truncateArgs(args.slice(0, -1), maxLength);
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -74,12 +72,11 @@ const truncateArgs = (args, maxLength) => {
|
||||
if (str.length === length) {
|
||||
return str;
|
||||
} else if (length > 5) {
|
||||
return "..." + str.slice(-length + 3);
|
||||
return `...${str.slice(-length + 3)}`;
|
||||
} else if (length > 0) {
|
||||
return str.slice(-length);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user