Skip to content

Commit

Permalink
move regex out of global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
AAP9002 committed Nov 16, 2023
1 parent dbcdd64 commit a28b431
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions server/features/forcedBreakPoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// @returns : the calender in string format
// @notes : Be aware the time is based on the server time not UTC

const regex = /^LAST-MODIFIED:.*/gm;

/**
* Force events to update format once a day
* @param {string} cal
Expand All @@ -19,6 +17,7 @@ function run(cal) {
// so this will manual set the last modified each day to force an update in the calender app
// NB. it will stop doing this at 4 am so any changes in the day will be recognised and updated live
// NB. 3 hour window set as the ICS is set to refresh evert 2 hours, so this should affect all users
const regex = /^LAST-MODIFIED:.*/gm;
const date = new Date();
const hour = date.getHours();
if (hour >= 1 && hour <= 4) {
Expand Down
3 changes: 1 addition & 2 deletions server/features/replaceCodeName.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
// @returns : the calender in string format


const pattern = /SUMMARY:[^\/]*\//g // REGEX to search the ICAL for the course code

/**
* List unique course names in the string
* @param {string} cal
* @returns List of unique course codes
*/
function parseCourseCodes(cal) {
const pattern = /SUMMARY:[^\/]*\//g // REGEX to search the ICAL for the course code
const uniqueMatches = new Set();

let match;
Expand Down

0 comments on commit a28b431

Please sign in to comment.