Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - ecuador ic validator prefix #124

Closed
henryv11 opened this issue Jan 13, 2025 · 2 comments
Closed

BUG - ecuador ic validator prefix #124

henryv11 opened this issue Jan 13, 2025 · 2 comments

Comments

@henryv11
Copy link

henryv11 commented Jan 13, 2025

Python stdnum library has this prefix validation:

if (number[:2] < '01' or number[:2] > '24') and (number[:2] not in ('30', '50')):
        raise InvalidComponent()  # invalid province code

This package has this:

export function validPrefix(value: string): boolean {
  const prefix = parseInt(value.substr(0, 2), 10);
  if (prefix === 0 || prefix > 24 || prefix === 30 || prefix === 50) {
    // Invalid province
    return false;
  }

  return true;
}

Should be:

export function validPrefix(value: string): boolean {
  const prefix = parseInt(value.substr(0, 2), 10);
    if ((prefix === 0 || prefix > 24) && !(prefix === 30 || prefix === 50)) {
    // Invalid province
    return false;
  }

  return true;
}
@koblas
Copy link
Owner

koblas commented Jan 14, 2025

Fixing with #125

@koblas
Copy link
Owner

koblas commented Jan 14, 2025

The fix is now merged, again thanks for finding the issue.

@koblas koblas closed this as completed Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants