feat(share): 抽出 buildShareText 纯函数 title\ndescription 单换行无url(分享重构 §5.1)

This commit is contained in:
lanterngamescn
2026-06-27 14:00:24 +08:00
parent a03c61e188
commit 15fadd7cdb
2 changed files with 17 additions and 0 deletions
@@ -0,0 +1,14 @@
/**
* 分享文本拼接(纯函数,可单测)。
* 规则(对齐原工程 + 用户确认):`title\ndescription`**单换行、三端一致、不含 url**;空字段跳过。
*/
export function buildShareText(title: string, description: string): string {
const parts: string[] = [];
if (title !== '') {
parts.push(title);
}
if (description !== '') {
parts.push(description);
}
return parts.join('\n');
}