1
0
Fork 1
mirror of https://example.com synced 2024-11-27 01:16:41 +09:00

[Client] Refactor: Better function name

This commit is contained in:
syuilo 2017-02-19 07:20:59 +09:00
parent 3b352d80cb
commit 790e96b13e

View file

@ -1,4 +1,4 @@
const getPostSummary = post => { const summarize = post => {
let summary = post.text ? post.text : ''; let summary = post.text ? post.text : '';
// メディアが添付されているとき // メディアが添付されているとき
@ -14,7 +14,7 @@ const getPostSummary = post => {
// 返信のとき // 返信のとき
if (post.reply_to_id) { if (post.reply_to_id) {
if (post.reply_to) { if (post.reply_to) {
replySummary = getPostSummary(post.reply_to); replySummary = summarize(post.reply_to);
summary += ` RE: ${replySummary}`; summary += ` RE: ${replySummary}`;
} else { } else {
summary += ' RE: ...'; summary += ' RE: ...';
@ -24,7 +24,7 @@ const getPostSummary = post => {
// Repostのとき // Repostのとき
if (post.repost_id) { if (post.repost_id) {
if (post.repost) { if (post.repost) {
repostSummary = getPostSummary(post.repost); repostSummary = summarize(post.repost);
summary += ` RP: ${repostSummary}`; summary += ` RP: ${repostSummary}`;
} else { } else {
summary += ' RP: ...'; summary += ' RP: ...';
@ -34,4 +34,4 @@ const getPostSummary = post => {
return summary.trim(); return summary.trim();
}; };
module.exports = getPostSummary; module.exports = summarize;