Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add slack source #3148

Merged
merged 16 commits into from
May 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: default event name normalization to undefined if it cannot be pa…
…rsed
  • Loading branch information
gitcommitshow committed May 9, 2024
commit db11c3e3d70d13a67d21c5b0043e74ce801bcb4a
12 changes: 8 additions & 4 deletions src/v0/sources/slack/util.js
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -49,10 +49,14 @@ function tsToISODate(slackTs) {
* console.log(normalizedEventName); // Output: "Member Joined Channel"
*/
function normalizeEventName(evtName) {
return evtName
.split('_')
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
.join(' ');
try {
return evtName
.split('_')
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
.join(' ');
} catch (e) {
return 'undefined';
}
}

module.exports = { mapping, tsToISODate, normalizeEventName };