mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[JS] Add the function AFExactMatch
This commit is contained in:
parent
294db228bc
commit
330048ad6b
2 changed files with 25 additions and 1 deletions
|
@ -683,6 +683,14 @@ class AForm {
|
|||
eMailValidate(str) {
|
||||
return this._emailRegex.test(str);
|
||||
}
|
||||
|
||||
AFExactMatch(rePatterns, str) {
|
||||
if (rePatterns instanceof RegExp) {
|
||||
return str.match(rePatterns)?.[0] === str || 0;
|
||||
}
|
||||
|
||||
return rePatterns.findIndex(re => str.match(re)?.[0] === str) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
export { AForm };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue