@sythos/js_barcode_universal 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/bundle/sythos-barcode.esm.js +34 -3
- package/bundle/sythos-barcode.js +34 -3
- package/package.json +1 -1
- package/src/index.js +33 -2
package/README.md
CHANGED
|
@@ -118,8 +118,8 @@ The `unpkg` and `jsdelivr` fields point at the IIFE bundle, so a CDN needs no in
|
|
|
118
118
|
|
|
119
119
|
```html
|
|
120
120
|
<script src="https://unpkg.com/@sythos/js_barcode_universal"></script>
|
|
121
|
-
<script src="https://unpkg.com/@sythos/js_barcode_universal@1.5.
|
|
122
|
-
<script src="https://cdn.jsdelivr.net/npm/@sythos/js_barcode_universal@1.5.
|
|
121
|
+
<script src="https://unpkg.com/@sythos/js_barcode_universal@1.5.3"></script>
|
|
122
|
+
<script src="https://cdn.jsdelivr.net/npm/@sythos/js_barcode_universal@1.5.3"></script>
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
Pin the version for anything you ship; the unpinned form resolves to `latest` and will move under
|
|
@@ -502,6 +502,8 @@ and go faster), `tryHarder` (retry inverted, default `true`), `binarizer`
|
|
|
502
502
|
(`'global' | 'hybrid' | 'auto'`). A `Result` carries at least `text` and `format`; QR results also
|
|
503
503
|
carry `bytes`, `version` and `ecc`.
|
|
504
504
|
|
|
505
|
+
For larger clean QR Code and PDF417 rasters, `auto` and `hybrid` retain their primary local-threshold pass and retry once with the global threshold only when that pass finds no result. An explicit `binarizer: 'global'` request remains single-pass.
|
|
506
|
+
|
|
505
507
|
```js
|
|
506
508
|
listFormats() → { id, label, canWrite, canRead, kind }[]
|
|
507
509
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Sythos Barcode Suite v1.5.
|
|
2
|
+
* Sythos Barcode Suite v1.5.3
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -16760,12 +16760,43 @@ function decode(image, options = {}) {
|
|
|
16760
16760
|
|
|
16761
16761
|
// De-duplicate: the same symbol is often read on several scan rows.
|
|
16762
16762
|
const seen = new Set();
|
|
16763
|
-
|
|
16763
|
+
const unique = results.filter((r) => {
|
|
16764
16764
|
const key = `${r.format}:${r.text}`;
|
|
16765
16765
|
if (seen.has(key)) return false;
|
|
16766
16766
|
seen.add(key);
|
|
16767
16767
|
return true;
|
|
16768
16768
|
});
|
|
16769
|
+
|
|
16770
|
+
// On large clean rasters, hybrid thresholding can erase otherwise uniform
|
|
16771
|
+
// QR/PDF417 modules. Keep auto/hybrid as the primary strategy, then make one
|
|
16772
|
+
// focused global retry only when the complete primary pass found nothing.
|
|
16773
|
+
// This deliberately leaves an explicit global request single-pass.
|
|
16774
|
+
const retryFormats = formats
|
|
16775
|
+
? formats.filter((format) => {
|
|
16776
|
+
const id = String(format).toLowerCase();
|
|
16777
|
+
return id === 'qr' || id === 'qrcode'
|
|
16778
|
+
|| id === 'pdf417' || id === 'pdf-417'
|
|
16779
|
+
|| id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417';
|
|
16780
|
+
})
|
|
16781
|
+
: ['qr', 'pdf417', 'compactpdf417'];
|
|
16782
|
+
const shouldRetryGlobal = unique.length === 0
|
|
16783
|
+
&& (binarizer === 'auto' || binarizer === 'hybrid')
|
|
16784
|
+
&& retryFormats.length > 0;
|
|
16785
|
+
|
|
16786
|
+
if (!shouldRetryGlobal) return unique;
|
|
16787
|
+
|
|
16788
|
+
const fallback = decode(image, {
|
|
16789
|
+
...options,
|
|
16790
|
+
formats: retryFormats,
|
|
16791
|
+
binarizer: 'global',
|
|
16792
|
+
});
|
|
16793
|
+
const fallbackSeen = new Set();
|
|
16794
|
+
return [...unique, ...fallback].filter((r) => {
|
|
16795
|
+
const key = `${r.format}:${r.text}`;
|
|
16796
|
+
if (fallbackSeen.has(key)) return false;
|
|
16797
|
+
fallbackSeen.add(key);
|
|
16798
|
+
return true;
|
|
16799
|
+
});
|
|
16769
16800
|
}
|
|
16770
16801
|
|
|
16771
16802
|
/**
|
|
@@ -16782,7 +16813,7 @@ function decodeStrict(image, options) {
|
|
|
16782
16813
|
}
|
|
16783
16814
|
|
|
16784
16815
|
/** Library version, matching package.json. */
|
|
16785
|
-
const VERSION = '1.5.
|
|
16816
|
+
const VERSION = '1.5.3';
|
|
16786
16817
|
|
|
16787
16818
|
__exports.listFormats = listFormats;
|
|
16788
16819
|
__exports.encode = encode;
|
package/bundle/sythos-barcode.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Sythos Barcode Suite v1.5.
|
|
2
|
+
* Sythos Barcode Suite v1.5.3
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -16761,12 +16761,43 @@ function decode(image, options = {}) {
|
|
|
16761
16761
|
|
|
16762
16762
|
// De-duplicate: the same symbol is often read on several scan rows.
|
|
16763
16763
|
const seen = new Set();
|
|
16764
|
-
|
|
16764
|
+
const unique = results.filter((r) => {
|
|
16765
16765
|
const key = `${r.format}:${r.text}`;
|
|
16766
16766
|
if (seen.has(key)) return false;
|
|
16767
16767
|
seen.add(key);
|
|
16768
16768
|
return true;
|
|
16769
16769
|
});
|
|
16770
|
+
|
|
16771
|
+
// On large clean rasters, hybrid thresholding can erase otherwise uniform
|
|
16772
|
+
// QR/PDF417 modules. Keep auto/hybrid as the primary strategy, then make one
|
|
16773
|
+
// focused global retry only when the complete primary pass found nothing.
|
|
16774
|
+
// This deliberately leaves an explicit global request single-pass.
|
|
16775
|
+
const retryFormats = formats
|
|
16776
|
+
? formats.filter((format) => {
|
|
16777
|
+
const id = String(format).toLowerCase();
|
|
16778
|
+
return id === 'qr' || id === 'qrcode'
|
|
16779
|
+
|| id === 'pdf417' || id === 'pdf-417'
|
|
16780
|
+
|| id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417';
|
|
16781
|
+
})
|
|
16782
|
+
: ['qr', 'pdf417', 'compactpdf417'];
|
|
16783
|
+
const shouldRetryGlobal = unique.length === 0
|
|
16784
|
+
&& (binarizer === 'auto' || binarizer === 'hybrid')
|
|
16785
|
+
&& retryFormats.length > 0;
|
|
16786
|
+
|
|
16787
|
+
if (!shouldRetryGlobal) return unique;
|
|
16788
|
+
|
|
16789
|
+
const fallback = decode(image, {
|
|
16790
|
+
...options,
|
|
16791
|
+
formats: retryFormats,
|
|
16792
|
+
binarizer: 'global',
|
|
16793
|
+
});
|
|
16794
|
+
const fallbackSeen = new Set();
|
|
16795
|
+
return [...unique, ...fallback].filter((r) => {
|
|
16796
|
+
const key = `${r.format}:${r.text}`;
|
|
16797
|
+
if (fallbackSeen.has(key)) return false;
|
|
16798
|
+
fallbackSeen.add(key);
|
|
16799
|
+
return true;
|
|
16800
|
+
});
|
|
16770
16801
|
}
|
|
16771
16802
|
|
|
16772
16803
|
/**
|
|
@@ -16783,7 +16814,7 @@ function decodeStrict(image, options) {
|
|
|
16783
16814
|
}
|
|
16784
16815
|
|
|
16785
16816
|
/** Library version, matching package.json. */
|
|
16786
|
-
const VERSION = '1.5.
|
|
16817
|
+
const VERSION = '1.5.3';
|
|
16787
16818
|
|
|
16788
16819
|
__exports.listFormats = listFormats;
|
|
16789
16820
|
__exports.encode = encode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sythos/js_barcode_universal",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Read and write barcodes in JavaScript with zero runtime dependencies. QR Code, Micro QR, rMQR, FrameQR Code, Aztec Code and Rune, PDF417 variants, GS1 DataBar Omnidirectional/Truncated, EAN supplements and one-dimensional formats.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Sythos",
|
package/src/index.js
CHANGED
|
@@ -535,12 +535,43 @@ export function decode(image, options = {}) {
|
|
|
535
535
|
|
|
536
536
|
// De-duplicate: the same symbol is often read on several scan rows.
|
|
537
537
|
const seen = new Set();
|
|
538
|
-
|
|
538
|
+
const unique = results.filter((r) => {
|
|
539
539
|
const key = `${r.format}:${r.text}`;
|
|
540
540
|
if (seen.has(key)) return false;
|
|
541
541
|
seen.add(key);
|
|
542
542
|
return true;
|
|
543
543
|
});
|
|
544
|
+
|
|
545
|
+
// On large clean rasters, hybrid thresholding can erase otherwise uniform
|
|
546
|
+
// QR/PDF417 modules. Keep auto/hybrid as the primary strategy, then make one
|
|
547
|
+
// focused global retry only when the complete primary pass found nothing.
|
|
548
|
+
// This deliberately leaves an explicit global request single-pass.
|
|
549
|
+
const retryFormats = formats
|
|
550
|
+
? formats.filter((format) => {
|
|
551
|
+
const id = String(format).toLowerCase();
|
|
552
|
+
return id === 'qr' || id === 'qrcode'
|
|
553
|
+
|| id === 'pdf417' || id === 'pdf-417'
|
|
554
|
+
|| id === 'compactpdf417' || id === 'compact-pdf417' || id === 'compact-pdf-417';
|
|
555
|
+
})
|
|
556
|
+
: ['qr', 'pdf417', 'compactpdf417'];
|
|
557
|
+
const shouldRetryGlobal = unique.length === 0
|
|
558
|
+
&& (binarizer === 'auto' || binarizer === 'hybrid')
|
|
559
|
+
&& retryFormats.length > 0;
|
|
560
|
+
|
|
561
|
+
if (!shouldRetryGlobal) return unique;
|
|
562
|
+
|
|
563
|
+
const fallback = decode(image, {
|
|
564
|
+
...options,
|
|
565
|
+
formats: retryFormats,
|
|
566
|
+
binarizer: 'global',
|
|
567
|
+
});
|
|
568
|
+
const fallbackSeen = new Set();
|
|
569
|
+
return [...unique, ...fallback].filter((r) => {
|
|
570
|
+
const key = `${r.format}:${r.text}`;
|
|
571
|
+
if (fallbackSeen.has(key)) return false;
|
|
572
|
+
fallbackSeen.add(key);
|
|
573
|
+
return true;
|
|
574
|
+
});
|
|
544
575
|
}
|
|
545
576
|
|
|
546
577
|
/**
|
|
@@ -557,4 +588,4 @@ export function decodeStrict(image, options) {
|
|
|
557
588
|
}
|
|
558
589
|
|
|
559
590
|
/** Library version, matching package.json. */
|
|
560
|
-
export const VERSION = '1.5.
|
|
591
|
+
export const VERSION = '1.5.3';
|