lindell / lindell/JsBarcode

Uncaught TypeError When Reading Undefined Text

Open
#391 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

As of version 3.5.9, the following line generates an uncaught type error when attempting to read the undefined `text`:
https://github.com/lindell/JsBarcode/blob/master/dist/JsBarcode.all.js#L190
The following minimal example from [CodePen](https://codepen.io/lindell/pen/grkZGQ) will work with 3.5.8 but not on or after 3.5.9:
````JS
const api = JsBarcode("#barcode");
api["CODE128"]("Hello");
api.blank(20);
api["CODE128"]("World");
api.render();
````
In contrast explicitly passing the text does render:
````JS
const api = JsBarcode("#barcode");
api["CODE128"]("Hello", { text: "Hello" });
api.blank(20);
api["CODE128"]("World", { text: "World" });
api.render();
````

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the CodePen example with JsBarcode 3.5.9 and inspect dist/JsBarcode.all.js around line 190, comparing it with 3.5.8. The fix is complete when the chained CODE128, blank, and render calls work without explicitly passing text and without an uncaught TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.