Skip to content

Commit

Permalink
remove list reversal
Browse files Browse the repository at this point in the history
  • Loading branch information
DayV-git committed Oct 18, 2024
1 parent 56c978b commit 29435b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/src/content/docs/osb/combat-achievements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Rewards can be claimed by simply using [[/ca claim]] after completing a new tier
| Obor | Obor Novice | 1x Obor KC |
| Obor | Fighting as Intended | 1 in 1 chance per kill |
| Obor | Sleeping Giant | 1 in 10 chance per kill |
| Other | Into the Den of Giants | 1x Hill Giant KC, 1x Moss giant KC and 1x Fire Giant KC |
| Other | Into the Den of Giants | 1x Fire Giant KC, 1x Moss giant KC and 1x Hill Giant KC |
| Sarachnis | Sarachnis Novice | 10x Sarachnis KC |
| Scurrius | Sit Rat | 1 in 1 chance per kill |
| Scurrius | Scurrius Novice | 1x Scurrius KC |
Expand Down
6 changes: 2 additions & 4 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,8 @@ export function replaceLast(str: string, pattern: string, replacement: string) {

export function joinStrings(itemList: any[], end?: string) {
if (itemList.length < 2) return itemList.join(', ');
if (
itemList.reverse()[0] &&
(typeof itemList.reverse()[0] !== 'string' || !itemList.reverse()[0].toString().includes(','))
) {
const lastItem = itemList[itemList.length - 1];
if (lastItem && (typeof lastItem !== 'string' || !lastItem.toString().includes(','))) {
return replaceLast(itemList.join(', '), ',', ` ${end ? end : 'and'}`);
} else {
// commas in last term will put str in weird place
Expand Down

0 comments on commit 29435b5

Please sign in to comment.