Skip to content

Commit

Permalink
fix: format names for case matching
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 2, 2022
1 parent 7c612fc commit ece2d90
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { upperFirst } from 'scule'
import { splitByCase, upperFirst } from 'scule'
import type { ChangelogConfig } from './config'
import type { GitCommit } from './git'

Expand Down Expand Up @@ -28,7 +28,7 @@ export function generateMarkDown (commits: GitCommit[], config: ChangelogConfig)
}
}

let authors = commits.flatMap(commit => commit.authors.map(author => upperFirst(author.name)))
let authors = commits.flatMap(commit => commit.authors.map(author => formatName(author.name)))
authors = uniq(authors).sort()

if (authors.length) {
Expand All @@ -49,6 +49,10 @@ function formatTitle (title: string = '') {
return title.length <= 3 ? title.toUpperCase() : upperFirst(title)
}

function formatName (name: string = '') {
return name.split(' ').map(p => upperFirst(p.trim())).join(' ')
}

function groupBy (items: any[], key: string) {
const groups = {}
for (const item of items) {
Expand Down

0 comments on commit ece2d90

Please sign in to comment.