@robinpath/barcode 0.1.0 → 0.1.1
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 +97 -0
- package/package.json +29 -8
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @robinpath/barcode
|
|
2
|
+
|
|
3
|
+
> QR code generation, EAN/UPC barcode validation, ISBN conversion, and Luhn checksum
|
|
4
|
+
|
|
5
|
+
   
|
|
6
|
+
|
|
7
|
+
## Why use this module?
|
|
8
|
+
|
|
9
|
+
The `barcode` module lets you:
|
|
10
|
+
|
|
11
|
+
- Generate QR code as data URL
|
|
12
|
+
- Generate QR code to file
|
|
13
|
+
- Generate QR code as SVG
|
|
14
|
+
- Generate QR for terminal
|
|
15
|
+
- Validate EAN-13 barcode
|
|
16
|
+
|
|
17
|
+
All functions are callable directly from RobinPath scripts with a simple, consistent API.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @robinpath/barcode
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
No credentials needed — start using it right away:
|
|
28
|
+
|
|
29
|
+
```robinpath
|
|
30
|
+
barcode.qrToFile "https://example.com" "./qr.png"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Available Functions
|
|
34
|
+
|
|
35
|
+
| Function | Description |
|
|
36
|
+
|----------|-------------|
|
|
37
|
+
| `barcode.qrGenerate` | Generate QR code as data URL |
|
|
38
|
+
| `barcode.qrToFile` | Generate QR code to file |
|
|
39
|
+
| `barcode.qrToSvg` | Generate QR code as SVG |
|
|
40
|
+
| `barcode.qrToTerminal` | Generate QR for terminal |
|
|
41
|
+
| `barcode.ean13Validate` | Validate EAN-13 barcode |
|
|
42
|
+
| `barcode.ean13Checksum` | Calculate EAN-13 check digit |
|
|
43
|
+
| `barcode.upcValidate` | Validate UPC-A barcode |
|
|
44
|
+
| `barcode.upcChecksum` | Calculate UPC-A check digit |
|
|
45
|
+
| `barcode.isbn10Validate` | Validate ISBN-10 |
|
|
46
|
+
| `barcode.isbn13Validate` | Validate ISBN-13 |
|
|
47
|
+
| `barcode.isbn10to13` | Convert ISBN-10 to ISBN-13 |
|
|
48
|
+
| `barcode.isbn13to10` | Convert ISBN-13 to ISBN-10 |
|
|
49
|
+
| `barcode.luhn` | Validate Luhn checksum |
|
|
50
|
+
| `barcode.luhnGenerate` | Generate Luhn check digit |
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
### Generate QR code to file
|
|
55
|
+
|
|
56
|
+
```robinpath
|
|
57
|
+
barcode.qrToFile "https://example.com" "./qr.png"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Generate QR code as SVG
|
|
61
|
+
|
|
62
|
+
```robinpath
|
|
63
|
+
barcode.qrToSvg "hello"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Generate QR for terminal
|
|
67
|
+
|
|
68
|
+
```robinpath
|
|
69
|
+
barcode.qrToTerminal "hello"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Integration with RobinPath
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { RobinPath } from "@wiredwp/robinpath";
|
|
76
|
+
import Module from "@robinpath/barcode";
|
|
77
|
+
|
|
78
|
+
const rp = new RobinPath();
|
|
79
|
+
rp.registerModule(Module.name, Module.functions);
|
|
80
|
+
rp.registerModuleMeta(Module.name, Module.functionMetadata);
|
|
81
|
+
|
|
82
|
+
const result = await rp.executeScript(`
|
|
83
|
+
barcode.qrToFile "https://example.com" "./qr.png"
|
|
84
|
+
`);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Full API Reference
|
|
88
|
+
|
|
89
|
+
See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
|
|
90
|
+
|
|
91
|
+
## Related Modules
|
|
92
|
+
|
|
93
|
+
- [`@robinpath/json`](../json) — JSON module for complementary functionality
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robinpath/barcode",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"publishConfig": {
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
5
7
|
"type": "module",
|
|
6
8
|
"main": "dist/index.js",
|
|
7
9
|
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "node --import tsx --test tests/*.test.ts"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@wiredwp/robinpath": ">=0.20.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"qrcode": "^1.5.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@wiredwp/robinpath": "^0.30.1",
|
|
31
|
+
"@types/qrcode": "^1.5.0",
|
|
32
|
+
"tsx": "^4.19.0",
|
|
33
|
+
"typescript": "^5.6.0"
|
|
34
|
+
}
|
|
14
35
|
}
|