a7ae54d7cc
This pull request refactors our TypeScript preflight check in preparation for dropping the `fork-ts-checker-webpack-plugin` plugin. This will make reviewing the subsequent PR much easier. --- There is no behavior change, so the existing test should cover this adequately.
14 lines
306 B
TypeScript
14 lines
306 B
TypeScript
export function getOxfordCommaList(items: string[]): string {
|
|
return items
|
|
.map(
|
|
(v, index, { length }) =>
|
|
(index > 0
|
|
? index === length - 1
|
|
? length > 2
|
|
? ', and '
|
|
: ' and '
|
|
: ', '
|
|
: '') + v
|
|
)
|
|
.join('')
|
|
}
|