File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import assertString from './util/assertString' ;
2+ import { CountryCodes } from './isISO31661Alpha2' ;
23
3- const isBICReg = / ^ [ A - z ] { 4 } [ A - z ] { 2 } \w { 2 } ( \w { 3 } ) ? $ / ;
4+ // https://en.wikipedia.org/wiki/ISO_9362
5+ const isBICReg = / ^ [ A - Z a - z ] { 6 } [ A - Z a - z 0 - 9 ] { 2 } ( [ A - Z a - z 0 - 9 ] { 3 } ) ? $ / ;
46
57export default function isBIC ( str ) {
68 assertString ( str ) ;
9+
10+ // toUpperCase() should be removed when a new major version goes out that changes
11+ // the regex to [A-Z] (per the spec).
12+ if ( CountryCodes . indexOf ( str . slice ( 4 , 6 ) . toUpperCase ( ) ) < 0 ) {
13+ return false ;
14+ }
15+
716 return isBICReg . test ( str ) ;
817}
Original file line number Diff line number Diff line change 11import assertString from './util/assertString' ;
2- import includes from './util/includes' ;
32
43// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
54const validISO31661Alpha2CountriesCodes = [
@@ -32,5 +31,7 @@ const validISO31661Alpha2CountriesCodes = [
3231
3332export default function isISO31661Alpha2 ( str ) {
3433 assertString ( str ) ;
35- return includes ( validISO31661Alpha2CountriesCodes , str . toUpperCase ( ) ) ;
34+ return validISO31661Alpha2CountriesCodes . indexOf ( str . toUpperCase ( ) ) >= 0 ;
3635}
36+
37+ export const CountryCodes = validISO31661Alpha2CountriesCodes ;
Original file line number Diff line number Diff line change 11import assertString from './util/assertString' ;
22
3- const localeReg = / ^ [ A - z ] { 2 , 4 } ( [ _ - ] ( [ A - z ] { 4 } | [ \d ] { 3 } ) ) ? ( [ _ - ] ( [ A - z ] { 2 } | [ \d ] { 3 } ) ) ? $ / ;
3+ const localeReg = / ^ [ A - Z a - z ] { 2 , 4 } ( [ _ - ] ( [ A - Z a - z ] { 4 } | [ \d ] { 3 } ) ) ? ( [ _ - ] ( [ A - Z a - z ] { 2 } | [ \d ] { 3 } ) ) ? $ / ;
44
55export default function isLocale ( str ) {
66 assertString ( str ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const patterns = {
3333 HT : / ^ H T \d { 4 } $ / ,
3434 HU : fourDigit ,
3535 ID : fiveDigit ,
36- IE : / ^ (? ! .* (?: o ) ) [ A - z ] \d [ \d w ] \s \w { 4 } $ / i,
36+ IE : / ^ (? ! .* (?: o ) ) [ A - Z a - z ] \d [ \d w ] \s \w { 4 } $ / i,
3737 IL : / ^ ( \d { 5 } | \d { 7 } ) $ / ,
3838 IN : / ^ ( (? ! 1 0 | 2 9 | 3 5 | 5 4 | 5 5 | 6 5 | 6 6 | 8 6 | 8 7 | 8 8 | 8 9 ) [ 1 - 9 ] [ 0 - 9 ] { 5 } ) $ / ,
3939 IR : / \b (? ! ( \d ) \1{ 3 } ) [ 1 3 - 9 ] { 4 } [ 1 3 4 6 - 9 ] [ 0 1 3 - 9 ] { 5 } \b / ,
You can’t perform that action at this time.
0 commit comments