Skip to content

Commit 5e64065

Browse files
committed
refactor: functional “some”
to reduce repetition!
1 parent a3475fa commit 5e64065

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class IsoDateParts {
4545
if(!dateTimeMatch) {
4646
throw new Error(`Unsupported date format: ${str}`);
4747
}
48-
if(dateTimeMatch[4]?.match(this.IS_FRACTIONAL_REGEX) || dateTimeMatch[5]?.match(this.IS_FRACTIONAL_REGEX)) {
48+
if(dateTimeMatch.slice(4,6).some(part => !!part?.match(this.IS_FRACTIONAL_REGEX))) {
4949
throw new Error(`Unsupported date format (fractional hours or minutes): ${str}`);
5050
}
5151

0 commit comments

Comments
 (0)