Skip to content

Commit

Permalink
apply coderabbitat suggestion to check duration units
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Oct 28, 2024
1 parent 2b90200 commit 6bdf1a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ical.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ module.exports = {
const indicator = curr.duration.startsWith('-') ? -1 : 1;

for (const r of duration) {
const unit = r.slice(-1);
if (!durationUnits[unit]) {
throw new Error(`Invalid duration unit: ${unit}`);
}
newEnd = newEnd.add(Number.parseInt(r, 10) * indicator, durationUnits[r.toString().slice(-1)]);

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (16.x, macos-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (18.x, windows-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (18.x, macos-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (20.x, ubuntu-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (20.x, windows-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (20.x, macos-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (22.x, ubuntu-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (22.x, windows-latest)

Expected blank line before this statement.

Check failure on line 486 in ical.js

View workflow job for this annotation

GitHub Actions / build (22.x, macos-latest)

Expected blank line before this statement.
}

Expand Down

0 comments on commit 6bdf1a3

Please sign in to comment.