Skip to content

Commit

Permalink
fix(Assistants): additional cleanup rule for Carrefour wrongly detect…
Browse files Browse the repository at this point in the history
…ed barcodes. ref #1204
  • Loading branch information
raphodn committed Jan 6, 2025
1 parent 7a7e48f commit d4f308c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ function isValidBarcode(value) {
function cleanBarcode(value) {
// keep only digits (remove letters, spaces, special characters)
value = value.replace(/\D/g, '')
// special case: 22 digits could be Carrefour
// special case: 19 or 22 digits could be Carrefour
// 182492/3119789831280 -> 1824923119789831280 -> 3119789831280
// 182492/3119789831280/051 -> 1824923119789831280051 -> 3119789831280
if (value.length === 22) {
if ((value.length === 19) || (value.length === 22)) {
value = value.substring(6, 6+13)
}
// remove leading zeros? no
Expand Down

0 comments on commit d4f308c

Please sign in to comment.