mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Introduce even more modern JavaScript features in the code-base
After PR 12563 we're now free to use e.g. logical OR assignment, nullish coalescing, and optional chaining in the entire code-base.
This commit is contained in:
parent
a24d5b629e
commit
e8030752f3
10 changed files with 25 additions and 31 deletions
|
@ -760,22 +760,20 @@ class PDFDateString {
|
|||
}
|
||||
|
||||
// Lazily initialize the regular expression.
|
||||
if (!pdfDateStringRegex) {
|
||||
pdfDateStringRegex = new RegExp(
|
||||
"^D:" + // Prefix (required)
|
||||
"(\\d{4})" + // Year (required)
|
||||
"(\\d{2})?" + // Month (optional)
|
||||
"(\\d{2})?" + // Day (optional)
|
||||
"(\\d{2})?" + // Hour (optional)
|
||||
"(\\d{2})?" + // Minute (optional)
|
||||
"(\\d{2})?" + // Second (optional)
|
||||
"([Z|+|-])?" + // Universal time relation (optional)
|
||||
"(\\d{2})?" + // Offset hour (optional)
|
||||
"'?" + // Splitting apostrophe (optional)
|
||||
"(\\d{2})?" + // Offset minute (optional)
|
||||
"'?" // Trailing apostrophe (optional)
|
||||
);
|
||||
}
|
||||
pdfDateStringRegex ||= new RegExp(
|
||||
"^D:" + // Prefix (required)
|
||||
"(\\d{4})" + // Year (required)
|
||||
"(\\d{2})?" + // Month (optional)
|
||||
"(\\d{2})?" + // Day (optional)
|
||||
"(\\d{2})?" + // Hour (optional)
|
||||
"(\\d{2})?" + // Minute (optional)
|
||||
"(\\d{2})?" + // Second (optional)
|
||||
"([Z|+|-])?" + // Universal time relation (optional)
|
||||
"(\\d{2})?" + // Offset hour (optional)
|
||||
"'?" + // Splitting apostrophe (optional)
|
||||
"(\\d{2})?" + // Offset minute (optional)
|
||||
"'?" // Trailing apostrophe (optional)
|
||||
);
|
||||
|
||||
// Optional fields that don't satisfy the requirements from the regular
|
||||
// expression (such as incorrect digit counts or numbers that are out of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue