Handling Leap Year Issue and more#126
Conversation
NavyStack
commented
Jan 1, 2024
- Explicitly assigning types to variables and parameters in TypeScript.
- Added a token testing process to account for leap years
- Fix missing some node.js dependencies, including "saslprep"
- Fix debounce strings
👷 Deploy request for simple-comment pending review.Visit the deploys page to approve it
|
| const toSlug = (str: string): string => { | ||
| return str | ||
| .toLowerCase() // Convert to lower case | ||
| .trim() // Remove leading and trailing spaces | ||
| .replace(/_/g, "-") // Replace underscores with dashes | ||
| .replace(/\s+/g, "-") // Replace all spaces with dashes | ||
| .replace(/[^a-z0-9-]/g, "") // Remove characters that are not lowercase letters, numbers, or dashes | ||
| .replace(/-+/g, "-") // Merge consecutive dashes into a single dash | ||
| } |
There was a problem hiding this comment.
I like the simplification and comments here. House style is to avoid a return statement when there are no local variables nor otherwise any need for a command block (curly brackets).
rendall
left a comment
There was a problem hiding this comment.
Hi @NavyStack
I really appreciate your effort here.
Could you read and acknowledge the Contributor License Agreement before I incorporate any of your code, please?
You don't have to "sign and return it" as indicated at the bottom. Just acknowledge in reply that you have read and agree to it. The idea is that I would like my company to retain complete ownership and autonomy over Simple Comment. Without explicit agreement, it seems sometimes a contribution can lead to misunderstandings about ownership.
Much appreciated!
|
I agree with CLA I noticed an error when I tested on January 1st KST, but it doesn't seem to occur now. Considering this situation, it would be prudent to use the actual JavaScript Intl.DateTimeFormat API to generate the output for each locale and then compare it with the expected format. |
|
Thank you very much for this PR. The codebase is undergoing a modernization effort now and I will use your idea to // Use a defined JWT_SECRET or a default for testing
const jwtSecret = process.env.JWT_SECRET || "default_test_secret" |