Skip to content

Commit

Permalink
chore: update tsdoc comments (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant committed Dec 11, 2024
1 parent cb8a076 commit c746aa7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
7 changes: 4 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ const imageFileReadResults = await readBarcodes(imageFile, readerOptions);
console.log(imageFileReadResults); // Hello world!

const writerOptions: WriterOptions = {
format: "Aztec",
scale: 3,
format: "EAN-13",
scale: 0,
withQuietZones: true,
withHRT: false,
};

console.log(await writeBarcode("Hello world!", writerOptions));
console.log(await writeBarcode("12345", writerOptions));
5 changes: 5 additions & 0 deletions src/bindings/readResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ export interface ReadResult
* Position of the detected barcode.
*/
position: Position;
/**
* @deprecated Use {@link ReadResult.ecLevel | `ReadResult.ecLevel`} instead.
*/
eccLevel: EcLevel;
}

export function zxingReadResultToReadResult(
Expand All @@ -139,5 +143,6 @@ export function zxingReadResultToReadResult(
...zxingReadResult,
format: decodeFormat(zxingReadResult.format),
contentType: decodeContentType(zxingReadResult.contentType),
eccLevel: zxingReadResult.ecLevel,
};
}
14 changes: 14 additions & 0 deletions src/bindings/writeResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
* @internal
*/
export interface ZXingWriteResult {
/**
* The encoded barcode as a scalable vector graphics (SVG) string.
*/
svg: string;
/**
* The encoded barcode as a utf8 string, using " ", "▀", "▄", "█".
*/
utf8: string;
/**
* @internal
*/
image?: Uint8Array;
/**
* Encoding error.
Expand All @@ -14,6 +23,11 @@ export interface ZXingWriteResult {
error: string;
}

/**
* Result of writing a barcode.
*
* @experimental The final form of this API is not yet settled and may change.
*/
export interface WriteResult extends Omit<ZXingWriteResult, "image"> {
/**
* The encoded barcode as an image blob.
Expand Down
23 changes: 14 additions & 9 deletions src/bindings/writerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export interface ZXingWriterOptions {
*/
readerInit: boolean;
/**
* TODO: TBD
*
* Force the Data Matrix to be square.
* @defaultValue `false`
*/
forceSquareDataMatrix: boolean;
Expand All @@ -30,31 +29,36 @@ export interface ZXingWriterOptions {
*/
ecLevel: EcLevel;
/**
* TODO: TBD
* The scale of the barcode. `0` means unset.
*
* @defaultValue `0`
*/
scale: number;
/**
* TODO: TBD
* A size hint to determine the scale of the barcode. `0` means unset.
*
* This only takes effect if `scale` is unset.
*
* @defaultValue `0`
*/
sizeHint: number;
/**
* TODO: TBD
* The rotation of the barcode in degrees.
* Valid values are `0`, `90`, `180` and `270`.
*
* @defaultValue `0`
*/
rotate: number;
/**
* TODO: TBD
* Include human readable text (HRT) in the barcode.
*
* @defaultValue `false`
*/
withHRT: boolean;
/**
* TODO: TBD
* Add compliant quiet zones to the barcode.
*
* `EAN-13`, `ITF`, `UPC-A` and `UPC-E` have compliant quiet zones added by default.
*
* @defaultValue `true`
*/
Expand All @@ -71,8 +75,9 @@ export interface WriterOptions
*
* Supported values are:
* `"Aztec"`, `"Codabar"`, `"Code39"`, `"Code93"`, `"Code128"`,
* `"DataBarExpanded"`, `"DataMatrix"`, `"EAN8"`, `"EAN13"`, `"ITF"`,
* `"PDF417"`, `"QRCode"`, `"UPCA"`, `"UPCE"`, `"DataBarLimited"`
* `"DataBar"`, `"DataBarExpanded"`, `"DataBarLimited"`, `"DataMatrix"`,
* `"EAN-8"`, `"EAN-13"`, `"ITF"`, `"MaxiCode"`, `"MicroQRCode"`, `"PDF417"`,
* `"QRCode"`, `"rMQRCode"`, `"UPC-A"`, `"UPC-E"`
*
* @defaultValue `"QRCode"`
*/
Expand Down

0 comments on commit c746aa7

Please sign in to comment.