106 lines
13 KiB
JavaScript
106 lines
13 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.createList = exports.getToBeInPastTense = exports.getConcatenatedValuesString = exports.getPluralSuffix = exports.splitQuotedText = exports.wordWrap = exports.removeTTYColors = void 0;
|
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
const DEFAULT_CONCATENATED_VALUES = {
|
|
SEPARATOR: ', ',
|
|
QUOTE_CHAR: '"',
|
|
};
|
|
function rtrim(str) {
|
|
return str.replace(/\s+$/, '');
|
|
}
|
|
function removeTTYColors(str) {
|
|
return str.replace(/\033\[[0-9;]*m/g, '');
|
|
}
|
|
exports.removeTTYColors = removeTTYColors;
|
|
function wordWrap(str, indent, width) {
|
|
let curStr = '';
|
|
let wrappedMsg = '';
|
|
if (removeTTYColors(str).length <= width - indent)
|
|
return (0, indent_string_1.default)(str, ' ', indent);
|
|
str = str.replace(/(\r\n)/gm, '\n')
|
|
.split(/(\S+[ \t]+)|(\S+(?:\n))|(\n)/m)
|
|
//NOTE: cut empty elements
|
|
.filter(elm => !!elm);
|
|
str.forEach(word => {
|
|
const newStr = curStr + word;
|
|
if (removeTTYColors(newStr).length > width - indent) {
|
|
wrappedMsg += `${rtrim(curStr)}\n`;
|
|
curStr = word;
|
|
}
|
|
else {
|
|
if (curStr[curStr.length - 1] === '\n') {
|
|
wrappedMsg += `${rtrim(curStr)}\n`;
|
|
curStr = '';
|
|
}
|
|
curStr += word;
|
|
}
|
|
});
|
|
return (0, indent_string_1.default)(wrappedMsg + curStr, ' ', indent);
|
|
}
|
|
exports.wordWrap = wordWrap;
|
|
function splitQuotedText(str, splitChar, quotes = '"\'') {
|
|
let currentPart = '';
|
|
const parts = [];
|
|
let quoteChar = null;
|
|
for (let i = 0; i < str.length; i++) {
|
|
const currentChar = str[i];
|
|
if (currentChar === splitChar) {
|
|
if (quoteChar)
|
|
currentPart += currentChar;
|
|
else {
|
|
parts.push(currentPart);
|
|
currentPart = '';
|
|
}
|
|
}
|
|
else if (quotes.indexOf(currentChar) > -1) {
|
|
if (quoteChar === currentChar)
|
|
quoteChar = null;
|
|
else if (!quoteChar)
|
|
quoteChar = currentChar;
|
|
else
|
|
currentPart += currentChar;
|
|
}
|
|
else
|
|
currentPart += currentChar;
|
|
}
|
|
if (currentPart)
|
|
parts.push(currentPart);
|
|
return parts;
|
|
}
|
|
exports.splitQuotedText = splitQuotedText;
|
|
function getPluralSuffix(array) {
|
|
return array.length > 1 ? 's' : '';
|
|
}
|
|
exports.getPluralSuffix = getPluralSuffix;
|
|
function getDisplayedItemText(item, quote) {
|
|
return `${quote}${item}${quote}`;
|
|
}
|
|
function getConcatenatedValuesString(array, separator = DEFAULT_CONCATENATED_VALUES.SEPARATOR, quoteChar = DEFAULT_CONCATENATED_VALUES.QUOTE_CHAR) {
|
|
const clonedArray = [...array];
|
|
if (separator.indexOf('\n') > -1)
|
|
return clonedArray.map(item => getDisplayedItemText(item, quoteChar)).join(separator);
|
|
else if (clonedArray.length === 1)
|
|
return getDisplayedItemText(clonedArray[0], quoteChar);
|
|
else if (clonedArray.length === 2) {
|
|
const item1 = array[0];
|
|
const item2 = array[1];
|
|
return `${getDisplayedItemText(item1, quoteChar)} and ${getDisplayedItemText(item2, quoteChar)}`;
|
|
}
|
|
const lastItem = clonedArray.pop();
|
|
const otherItemString = clonedArray.map(item => getDisplayedItemText(item, quoteChar)).join(separator);
|
|
return `${otherItemString}, and ${getDisplayedItemText(lastItem, quoteChar)}`;
|
|
}
|
|
exports.getConcatenatedValuesString = getConcatenatedValuesString;
|
|
function getToBeInPastTense(array) {
|
|
return array.length > 1 ? 'were' : 'was';
|
|
}
|
|
exports.getToBeInPastTense = getToBeInPastTense;
|
|
function createList(array, PREFIX = '- ', SEPARATOR = '\n') {
|
|
return array.map(option => PREFIX + option).join(SEPARATOR);
|
|
}
|
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LCB3aWR0aCkge1xuICAgIGxldCBjdXJTdHIgICAgID0gJyc7XG4gICAgbGV0IHdyYXBwZWRNc2cgPSAnJztcblxuICAgIGlmIChyZW1vdmVUVFlDb2xvcnMoc3RyKS5sZW5ndGggPD0gd2lkdGggLSBpbmRlbnQpXG4gICAgICAgIHJldHVybiBpbmRlbnRTdHJpbmcoc3RyLCAnICcsIGluZGVudCk7XG5cbiAgICBzdHIgPSBzdHIucmVwbGFjZSgvKFxcclxcbikvZ20sICdcXG4nKVxuICAgICAgICAuc3BsaXQoLyhcXFMrWyBcXHRdKyl8KFxcUysoPzpcXG4pKXwoXFxuKS9tKVxuICAgICAgICAvL05PVEU6IGN1dCBlbXB0eSBlbGVtZW50c1xuICAgICAgICAuZmlsdGVyKGVsbSA9PiAhIWVsbSk7XG5cbiAgICBzdHIuZm9yRWFjaCh3b3JkID0+IHtcbiAgICAgICAgY29uc3QgbmV3U3RyID0gY3VyU3RyICsgd29yZDtcblxuICAgICAgICBpZiAocmVtb3ZlVFRZQ29sb3JzKG5ld1N0cikubGVuZ3RoID4gd2lkdGggLSBpbmRlbnQpIHtcbiAgICAgICAgICAgIHdyYXBwZWRNc2cgKz0gYCR7cnRyaW0oY3VyU3RyKX1cXG5gO1xuICAgICAgICAgICAgY3VyU3RyID0gd29yZDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIGlmIChjdXJTdHJbY3VyU3RyLmxlbmd0aCAtIDFdID09PSAnXFxuJykge1xuICAgICAgICAgICAgICAgIHdyYXBwZWRNc2cgKz0gYCR7cnRyaW0oY3VyU3RyKX1cXG5gO1xuICAgICAgICAgICAgICAgIGN1clN0ciA9ICcnO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjdXJTdHIgKz0gd29yZDtcbiAgICAgICAgfVxuICAgIH0pO1xuXG4gICAgcmV0dXJuIGluZGVudFN0cmluZyh3cmFwcGVkTXNnICsgY3VyU3RyLCAnICcsIGluZGVudCk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBzcGxpdFF1b3RlZFRleHQgKHN0ciwgc3BsaXRDaGFyLCBxdW90ZXMgPSAnXCJcXCcnKSB7XG4gICAgbGV0IGN1cnJlbnRQYXJ0ID0gJyc7XG4gICAgY29uc3QgcGFydHMgICAgICAgPSBbXTtcbiAgICBsZXQgcXVvdGVDaGFyICAgPSBudWxsO1xuXG4gICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgY29uc3QgY3VycmVudENoYXIgPSBzdHJbaV07XG5cbiAgICAgICAgaWYgKGN1cnJlbnRDaGFyID09PSBzcGxpdENoYXIpIHtcbiAgICAgICAgICAgIGlmIChxdW90ZUNoYXIpXG4gICAgICAgICAgICAgICAgY3VycmVudFBhcnQgKz0gY3VycmVudENoYXI7XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBwYXJ0cy5wdXNoKGN1cnJlbnRQYXJ0KTtcbiAgICAgICAgICAgICAgICBjdXJyZW50UGFydCA9ICcnO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHF1b3Rlcy5pbmRleE9mKGN1cnJlbnRDaGFyKSA+IC0xKSB7XG4gICAgICAgICAgICBpZiAocXVvdGVDaGFyID09PSBjdXJyZW50Q2hhcilcbiAgICAgICAgICAgICAgICBxdW90ZUNoYXIgPSBudWxsO1xuICAgICAgICAgICAgZWxzZSBpZiAoIXF1b3RlQ2hhcilcbiAgICAgICAgICAgICAgICBxdW90ZUNoYXIgPSBjdXJyZW50Q2hhcjtcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBjdXJyZW50UGFydCArPSBjdXJyZW50Q2hhcjtcbiAgICAgICAgfVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBjdXJyZW50UGFydCArPSBjdXJyZW50Q2hhcjtcbiAgICB9XG5cbiAgICBpZiAoY3VycmVudFBhcnQpXG4g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