MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / splitDisplayName

Function splitDisplayName

apps/api/src/lib/oauth/oauth.utils.ts:100–119  ·  view source on GitHub ↗
(
  full: string
)

Source from the content-addressed store, hash-verified

98 * providers that don't return structured name fields (notably GitHub).
99 */
100export const splitDisplayName = (
101 full: string
102): { firstName: string; lastName: string } => {
103 const trimmed = full.trim();
104
105 if (trimmed === "") {
106 return { firstName: "", lastName: "" };
107 }
108
109 const parts = trimmed.split(/\s+/);
110
111 if (parts.length === 1) {
112 return { firstName: parts[0] ?? "", lastName: "" };
113 }
114
115 return {
116 firstName: parts[0] ?? "",
117 lastName: parts.slice(1).join(" "),
118 };
119};
120
121const OAUTH_FETCH_TIMEOUT_MS = 10_000;
122

Callers 2

fetchProfileMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected