Skip to content

Commit

Permalink
Improved emojiKey and randomEmoji regex for better match
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Oct 11, 2020
1 parent 88444ab commit 3bfa549
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blog-post-workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ Promise.allSettled(promiseArray).then((results) => {
const seed = (process.env.GITHUB_REPOSITORY && !process.env.TEST_MODE ?
process.env.GITHUB_REPOSITORY : 'example') + index;
const emoji = randEmojiArr[rand.create(seed).range(randEmojiArr.length)];
content = content.replace(/\$randomEmoji\((.)*\)/g, emoji);
content = content.replace(/\$randomEmoji\((\S)*\)/g, emoji);
}

// Emoji implementation: Static
if (constEmojiArr) {
// using modulus
content = content.replace(/\$emojiKey\((.)*\)/g, constEmojiArr[index % constEmojiArr.length]);
content = content.replace(/\$emojiKey\((\S)*\)/g, constEmojiArr[index % constEmojiArr.length]);
}

return acc + content;
Expand Down

0 comments on commit 3bfa549

Please sign in to comment.