templating api

This commit is contained in:
2026-06-19 22:20:43 -07:00
parent 08d7a80f56
commit 84f894c356
110 changed files with 12432 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import { last } from "lodash"
export function toSentence(items: string[]): string {
if (items.length === 0) return ""
if (items.length === 1) return items[0]
if (items.length === 2) return items.join(" and ")
const itemsExceptLast = items.slice(0, -1).join(", ")
const lastItem = last(items)
return `${itemsExceptLast}, and ${lastItem}`
}
export default toSentence