From 3e460da67d71b0f3219c812f2b5eaa6ab236b572 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 8 Dec 2024 17:34:11 +0200 Subject: [PATCH] web/util: remove oxfordHumanJoin --- web/src/ui/timeline/content/PinnedEventsBody.tsx | 8 ++++---- web/src/util/join.ts | 2 -- web/src/util/reactjoin.tsx | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/web/src/ui/timeline/content/PinnedEventsBody.tsx b/web/src/ui/timeline/content/PinnedEventsBody.tsx index 50e03a8..c46908d 100644 --- a/web/src/ui/timeline/content/PinnedEventsBody.tsx +++ b/web/src/ui/timeline/content/PinnedEventsBody.tsx @@ -15,18 +15,18 @@ // along with this program. If not, see . import { PinnedEventsContent } from "@/api/types" import { listDiff } from "@/util/diff.ts" -import { oxfordHumanJoin } from "@/util/join.ts" +import { humanJoin } from "@/util/join.ts" import EventContentProps from "./props.ts" function renderPinChanges(content: PinnedEventsContent, prevContent?: PinnedEventsContent): string { const [added, removed] = listDiff(content.pinned ?? [], prevContent?.pinned ?? []) if (added.length) { if (removed.length) { - return `pinned ${oxfordHumanJoin(added)} and unpinned ${oxfordHumanJoin(removed)}` + return `pinned ${humanJoin(added)} and unpinned ${humanJoin(removed)}` } - return `pinned ${oxfordHumanJoin(added)}` + return `pinned ${humanJoin(added)}` } else if (removed.length) { - return `unpinned ${oxfordHumanJoin(removed)}` + return `unpinned ${humanJoin(removed)}` } else { return "sent a no-op pin event" } diff --git a/web/src/util/join.ts b/web/src/util/join.ts index 0a05ea7..2252efb 100644 --- a/web/src/util/join.ts +++ b/web/src/util/join.ts @@ -25,5 +25,3 @@ export function humanJoin(arr: string[], sep: string = ", ", lastSep: string = " } return arr.slice(0, -1).join(sep) + lastSep + arr[arr.length - 1] } - -export const oxfordHumanJoin = (arr: string[]) => humanJoin(arr, ", ", ", and ") diff --git a/web/src/util/reactjoin.tsx b/web/src/util/reactjoin.tsx index e784759..96f450d 100644 --- a/web/src/util/reactjoin.tsx +++ b/web/src/util/reactjoin.tsx @@ -27,5 +27,4 @@ export function humanJoinReact( ) } -export const oxfordHumanJoinReact = (arr: (string | JSX.Element)[]) => humanJoinReact(arr, ", ", ", and ") export const joinReact = (arr: (string | JSX.Element)[]) => humanJoinReact(arr, " ", " ")