|
|
@@ -40,16 +40,17 @@ const _arrangeByType = postsList => {
|
|
40
|
40
|
return flatPacked
|
|
41
|
41
|
}
|
|
42
|
42
|
|
|
|
43
|
+let seenTitles = []
|
|
43
|
44
|
const _arrangeByAlpha = postsList => {
|
|
44
|
45
|
const alphabet = [...'9abcdefghijklmnopqrstuvwxyz']
|
|
45
|
46
|
const flatPacked = []
|
|
46
|
47
|
|
|
47
|
48
|
const storeTitle = letter => {
|
|
48
|
|
- if(state.seenTitles.includes(letter)) return
|
|
|
49
|
+ if(seenTitles.includes(letter)) return
|
|
49
|
50
|
flatPacked.push({ slug: letter, title: letter, inbetween: true })
|
|
50
|
|
- state.seenTitles.push(letter)
|
|
|
51
|
+ seenTitles.push(letter)
|
|
51
|
52
|
}
|
|
52
|
|
-
|
|
|
53
|
+
|
|
53
|
54
|
postsList.forEach(post => {
|
|
54
|
55
|
const lastWord = post.slug.split('-').filter(c => c).pop()
|
|
55
|
56
|
const firstCharaOflastWord = lastWord[0]
|
|
|
@@ -59,6 +60,7 @@ const _arrangeByAlpha = postsList => {
|
|
59
|
60
|
storeTitle(alphabet[charaIndex])
|
|
60
|
61
|
flatPacked.push(post)
|
|
61
|
62
|
})
|
|
|
63
|
+ seenTitles = []
|
|
62
|
64
|
return flatPacked
|
|
63
|
65
|
}
|
|
64
|
66
|
|