Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function truncateCommitMessage(message: string): string {
const title = (message || "").split("\n")[0];
const escapedTitle = escape(title);
if (escapedTitle.length <= 50) {
return escapedTitle;
}
const splitRegExp = /(&(?:[gl]t|amp);|<.*?\||>)/;
const titleParts = escapedTitle.split(splitRegExp);
let truncatedTitle = "";
let addNext = 1;
let i;
for (i = 0; i < titleParts.length; i++) {
let newTitle = truncatedTitle;
if (i % 2 === 0) {
newTitle += titleParts[i];
} else if (/^&(?:[gl]t|amp);$/.test(titleParts[i])) {
newTitle += "&";
export function truncateCommitMessage(message: string, repo: any): string {
const title = message.split("\n")[0];
const escapedTitle = slack.escape(title);
const linkedTitle = linkIssues(escapedTitle, repo);
if (linkedTitle.length <= 50) {
return linkedTitle;
}
const splitRegExp = /(&(?:[gl]t|amp);|<.*?\||>)/;
const titleParts = linkedTitle.split(splitRegExp);
let truncatedTitle = "";
let addNext = 1;
let i;
for (i = 0; i < titleParts.length; i++) {
let newTitle = truncatedTitle;
if (i % 2 === 0) {
newTitle += titleParts[i];
} else if (/^&(?:[gl]t|amp);$/.test(titleParts[i])) {