Skip to content

fix: isISO31661Alpha2 currently allowing lowercase characters #2629

@jpgorman

Description

@jpgorman

Description

The current IsISO31661Alpha2 method used to check country codes allows for lower case country codes. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

Minimal code-snippet showcasing the problem

import {isISO31661Alpha2} from 'classValidator'
expect(isISO31661Alpha2('za')).toBe(true)

Expected behavior

import {isISO31661Alpha2} from 'classValidator'
// passes
expect(isISO31661Alpha2('za')).toBe(false)

Actual behavior

import {isISO31661Alpha2} from 'classValidator'
// fails
expect(isISO31661Alpha2('za')).toBe(false)

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions