Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/isISO6346.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import assertString from './util/assertString';
// https://en.wikipedia.org/wiki/ISO_6346
// according to ISO6346 standard, checksum digit is mandatory for freight container but recommended
// for other container types (J and Z)
const isISO6346Str = /^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/;
const isISO6346Str = /^[A-Z]{3}(U[0-9]{7}|[JZ][0-9]{6,7})$/;
const isDigit = /^[0-9]$/;

export function isISO6346(str) {
Expand Down
6 changes: 6 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13537,6 +13537,9 @@ describe('Validators', () => {
'ECMJ4657496',
'TBJA7176445',
'AFFU5962593',
'ABCU1234567GARBAGE', // trailing garbage after a valid prefix
'GARBAGEZ123456', // leading garbage before a valid suffix
'XYZ,123456', // comma is not a valid category identifier
],
});
});
Expand All @@ -13562,6 +13565,9 @@ describe('Validators', () => {
'ECMJ4657496',
'TBJA7176445',
'AFFU5962593',
'ABCU1234567GARBAGE', // trailing garbage after a valid prefix
'GARBAGEZ123456', // leading garbage before a valid suffix
'XYZ,123456', // comma is not a valid category identifier
],
});
});
Expand Down
Loading