Skip to content

Commit

Permalink
refactor: update code
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemain committed Aug 29, 2023
1 parent 7e0dbe4 commit 9bd3ae1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions build-cfworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async function buildWorker() {
platform: 'browser',
target: 'es2020',
format: 'esm',
treeShaking: true,
plugins: [resolvePlugin],
define: DEFAULT_BUILD_ARGS,
});
Expand Down
15 changes: 7 additions & 8 deletions src/github/templates/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Repository } from '@octokit/webhooks-types';
import _ from 'lodash';
import capitalize from 'lodash/capitalize';

import { StringBuilder } from '@/utils';

Expand Down Expand Up @@ -198,14 +198,13 @@ export function useRef(text?: string | null | undefined, bodyLimit = -1) {
const arrayOfLines = text.replace(/\r\n|\n\r|\n|\r/g, '\n').split('\n');
const newLines = [];

for (let line of arrayOfLines) {
for (const line of arrayOfLines) {
if (line) {
if (line === '>') {
if (line === '>' || line.startsWith('> ')) {
newLines.push(line);
continue;
} else if (line.startsWith('> ')) {
line = line.substring(2);
}

newLines.push(`> ${line}`);
} else {
newLines.push(`>`);
Expand Down Expand Up @@ -270,10 +269,10 @@ type TitleTpl = (
capitalize?: boolean,
) => string;

export const titleTpl: TitleTpl = (data, ctx, capitalize = true) => {
export const titleTpl: TitleTpl = (data, ctx, shouldCapitalize = true) => {
let event = data.event;
if (capitalize) {
event = _.capitalize(event);
if (shouldCapitalize) {
event = capitalize(event);
}
const info = `${event} ${data.action}`;
let text;
Expand Down

0 comments on commit 9bd3ae1

Please sign in to comment.