isahaq-barcode 1.0.0 → 1.2.0

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/eslint.config.js CHANGED
@@ -1,68 +1,66 @@
1
- module.exports = [
2
- {
3
- files: ['**/*.js'],
4
- languageOptions: {
5
- ecmaVersion: 2022,
6
- sourceType: 'module',
7
- globals: {
8
- console: 'readonly',
9
- process: 'readonly',
10
- Buffer: 'readonly',
11
- __dirname: 'readonly',
12
- __filename: 'readonly',
13
- global: 'readonly',
14
- module: 'readonly',
15
- require: 'readonly',
16
- exports: 'readonly',
17
- document: 'readonly'
18
- }
19
- },
20
- rules: {
21
- 'indent': ['error', 2],
22
- 'quotes': ['error', 'single'],
23
- 'semi': ['error', 'always'],
24
- 'no-unused-vars': 'warn',
25
- 'no-console': 'off',
26
- 'no-undef': 'error',
27
- 'no-trailing-spaces': 'error',
28
- 'eol-last': 'error'
29
- }
30
- },
31
- {
32
- files: ['tests/**/*.js', '**/*.test.js'],
33
- languageOptions: {
34
- ecmaVersion: 2022,
35
- sourceType: 'module',
36
- globals: {
37
- console: 'readonly',
38
- process: 'readonly',
39
- Buffer: 'readonly',
40
- __dirname: 'readonly',
41
- __filename: 'readonly',
42
- global: 'readonly',
43
- module: 'readonly',
44
- require: 'readonly',
45
- exports: 'readonly',
46
- describe: 'readonly',
47
- test: 'readonly',
48
- it: 'readonly',
49
- expect: 'readonly',
50
- beforeEach: 'readonly',
51
- afterEach: 'readonly',
52
- beforeAll: 'readonly',
53
- afterAll: 'readonly',
54
- jest: 'readonly'
55
- }
56
- },
57
- rules: {
58
- 'indent': ['error', 2],
59
- 'quotes': ['error', 'single'],
60
- 'semi': ['error', 'always'],
61
- 'no-unused-vars': 'warn',
62
- 'no-console': 'off',
63
- 'no-undef': 'error',
64
- 'no-trailing-spaces': 'error',
65
- 'eol-last': 'error'
66
- }
67
- }
68
- ];
1
+ module.exports = [
2
+ {
3
+ files: ['**/*.js'],
4
+ languageOptions: {
5
+ ecmaVersion: 2022,
6
+ sourceType: 'module',
7
+ globals: {
8
+ console: 'readonly',
9
+ process: 'readonly',
10
+ Buffer: 'readonly',
11
+ __dirname: 'readonly',
12
+ __filename: 'readonly',
13
+ global: 'readonly',
14
+ module: 'readonly',
15
+ require: 'readonly',
16
+ exports: 'readonly',
17
+ document: 'readonly',
18
+ },
19
+ },
20
+ plugins: {
21
+ prettier: require('eslint-plugin-prettier'),
22
+ },
23
+ rules: {
24
+ 'prettier/prettier': 'error',
25
+ 'no-unused-vars': 'warn',
26
+ 'no-console': 'off',
27
+ 'no-undef': 'error',
28
+ },
29
+ },
30
+ {
31
+ files: ['tests/**/*.js', '**/*.test.js'],
32
+ languageOptions: {
33
+ ecmaVersion: 2022,
34
+ sourceType: 'module',
35
+ globals: {
36
+ console: 'readonly',
37
+ process: 'readonly',
38
+ Buffer: 'readonly',
39
+ __dirname: 'readonly',
40
+ __filename: 'readonly',
41
+ global: 'readonly',
42
+ module: 'readonly',
43
+ require: 'readonly',
44
+ exports: 'readonly',
45
+ describe: 'readonly',
46
+ test: 'readonly',
47
+ it: 'readonly',
48
+ expect: 'readonly',
49
+ beforeEach: 'readonly',
50
+ afterEach: 'readonly',
51
+ beforeAll: 'readonly',
52
+ afterAll: 'readonly',
53
+ jest: 'readonly',
54
+ },
55
+ },
56
+ plugins: {
57
+ prettier: require('eslint-plugin-prettier'),
58
+ },
59
+ rules: {
60
+ 'prettier/prettier': 'error',
61
+ 'no-unused-vars': 'warn',
62
+ 'no-console': 'off',
63
+ 'no-undef': 'error',
64
+ },
65
+ },
66
+ ];
@@ -1,58 +1,58 @@
1
- /**
2
- * Basic usage examples for Isahaq Barcode Generator
3
- */
4
-
5
- const BarcodeGenerator = require('../index');
6
-
7
- async function basicExamples() {
8
- console.log('🚀 Basic Barcode Generation Examples\n');
9
-
10
- // 1. Generate PNG barcode
11
- console.log('1. Generating PNG barcode...');
12
- const pngBuffer = BarcodeGenerator.png('1234567890', 'code128');
13
- console.log(` PNG buffer size: ${pngBuffer.length} bytes`);
14
-
15
- // 2. Generate SVG barcode
16
- console.log('2. Generating SVG barcode...');
17
- const svgString = BarcodeGenerator.svg('1234567890', 'ean13');
18
- console.log(` SVG length: ${svgString.length} characters`);
19
-
20
- // 3. Generate HTML barcode
21
- console.log('3. Generating HTML barcode...');
22
- const htmlString = BarcodeGenerator.html('1234567890', 'code39');
23
- console.log(` HTML length: ${htmlString.length} characters`);
24
-
25
- // 4. Generate PDF barcode
26
- console.log('4. Generating PDF barcode...');
27
- const pdfBuffer = await BarcodeGenerator.pdf('1234567890', 'code128');
28
- console.log(` PDF buffer size: ${pdfBuffer.length} bytes`);
29
-
30
- // 5. Generate QR code
31
- console.log('5. Generating QR code...');
32
- const qrCode = BarcodeGenerator.modernQr({
33
- data: 'https://example.com',
34
- size: 300,
35
- margin: 10,
36
- });
37
- const qrBuffer = await qrCode.generate();
38
- console.log(` QR code buffer size: ${qrBuffer.length} bytes`);
39
-
40
- // 6. Generate QR code with logo
41
- console.log('6. Generating QR code with logo...');
42
- const qrWithLogo = BarcodeGenerator.modernQr({
43
- data: 'https://example.com',
44
- size: 300,
45
- logoPath: 'path/to/logo.png',
46
- logoSize: 60,
47
- label: 'Scan me!',
48
- });
49
- const qrWithLogoBuffer = await qrWithLogo.generate();
50
- console.log(
51
- ` QR code with logo buffer size: ${qrWithLogoBuffer.length} bytes`
52
- );
53
-
54
- console.log('\n✅ All examples completed successfully!');
55
- }
56
-
57
- // Run examples
58
- basicExamples().catch(console.error);
1
+ /**
2
+ * Basic usage examples for Isahaq Barcode Generator
3
+ */
4
+
5
+ const BarcodeGenerator = require('../index');
6
+
7
+ async function basicExamples() {
8
+ console.log('🚀 Basic Barcode Generation Examples\n');
9
+
10
+ // 1. Generate PNG barcode
11
+ console.log('1. Generating PNG barcode...');
12
+ const pngBuffer = BarcodeGenerator.png('1234567890', 'code128');
13
+ console.log(` PNG buffer size: ${pngBuffer.length} bytes`);
14
+
15
+ // 2. Generate SVG barcode
16
+ console.log('2. Generating SVG barcode...');
17
+ const svgString = BarcodeGenerator.svg('1234567890', 'ean13');
18
+ console.log(` SVG length: ${svgString.length} characters`);
19
+
20
+ // 3. Generate HTML barcode
21
+ console.log('3. Generating HTML barcode...');
22
+ const htmlString = BarcodeGenerator.html('1234567890', 'code39');
23
+ console.log(` HTML length: ${htmlString.length} characters`);
24
+
25
+ // 4. Generate PDF barcode
26
+ console.log('4. Generating PDF barcode...');
27
+ const pdfBuffer = await BarcodeGenerator.pdf('1234567890', 'code128');
28
+ console.log(` PDF buffer size: ${pdfBuffer.length} bytes`);
29
+
30
+ // 5. Generate QR code
31
+ console.log('5. Generating QR code...');
32
+ const qrCode = BarcodeGenerator.modernQr({
33
+ data: 'https://example.com',
34
+ size: 300,
35
+ margin: 10,
36
+ });
37
+ const qrBuffer = await qrCode.generate();
38
+ console.log(` QR code buffer size: ${qrBuffer.length} bytes`);
39
+
40
+ // 6. Generate QR code with logo
41
+ console.log('6. Generating QR code with logo...');
42
+ const qrWithLogo = BarcodeGenerator.modernQr({
43
+ data: 'https://example.com',
44
+ size: 300,
45
+ logoPath: 'path/to/logo.png',
46
+ logoSize: 60,
47
+ label: 'Scan me!',
48
+ });
49
+ const qrWithLogoBuffer = await qrWithLogo.generate();
50
+ console.log(
51
+ ` QR code with logo buffer size: ${qrWithLogoBuffer.length} bytes`
52
+ );
53
+
54
+ console.log('\n✅ All examples completed successfully!');
55
+ }
56
+
57
+ // Run examples
58
+ basicExamples().catch(console.error);
@@ -1,56 +1,56 @@
1
- [
2
- {
3
- "data": "1234567890",
4
- "type": "code128",
5
- "format": "png",
6
- "options": {
7
- "width": 3,
8
- "height": 150,
9
- "displayValue": true
10
- }
11
- },
12
- {
13
- "data": "9876543210",
14
- "type": "code39",
15
- "format": "svg",
16
- "options": {
17
- "width": 2,
18
- "height": 100,
19
- "displayValue": false
20
- }
21
- },
22
- {
23
- "data": "1234567890123",
24
- "type": "ean13",
25
- "format": "png",
26
- "options": {
27
- "width": 2,
28
- "height": 120,
29
- "displayValue": true
30
- }
31
- },
32
- {
33
- "data": "https://example.com",
34
- "type": "qrcode",
35
- "format": "png",
36
- "options": {
37
- "size": 300,
38
- "margin": 10,
39
- "logoPath": "path/to/logo.png",
40
- "logoSize": 60,
41
- "label": "Scan me!"
42
- }
43
- },
44
- {
45
- "data": "https://github.com",
46
- "type": "qrcode",
47
- "format": "png",
48
- "options": {
49
- "size": 400,
50
- "margin": 15,
51
- "watermark": "GitHub",
52
- "watermarkPosition": "center",
53
- "errorCorrectionLevel": "H"
54
- }
55
- }
56
- ]
1
+ [
2
+ {
3
+ "data": "1234567890",
4
+ "type": "code128",
5
+ "format": "png",
6
+ "options": {
7
+ "width": 3,
8
+ "height": 150,
9
+ "displayValue": true
10
+ }
11
+ },
12
+ {
13
+ "data": "9876543210",
14
+ "type": "code39",
15
+ "format": "svg",
16
+ "options": {
17
+ "width": 2,
18
+ "height": 100,
19
+ "displayValue": false
20
+ }
21
+ },
22
+ {
23
+ "data": "1234567890123",
24
+ "type": "ean13",
25
+ "format": "png",
26
+ "options": {
27
+ "width": 2,
28
+ "height": 120,
29
+ "displayValue": true
30
+ }
31
+ },
32
+ {
33
+ "data": "https://example.com",
34
+ "type": "qrcode",
35
+ "format": "png",
36
+ "options": {
37
+ "size": 300,
38
+ "margin": 10,
39
+ "logoPath": "path/to/logo.png",
40
+ "logoSize": 60,
41
+ "label": "Scan me!"
42
+ }
43
+ },
44
+ {
45
+ "data": "https://github.com",
46
+ "type": "qrcode",
47
+ "format": "png",
48
+ "options": {
49
+ "size": 400,
50
+ "margin": 15,
51
+ "watermark": "GitHub",
52
+ "watermarkPosition": "center",
53
+ "errorCorrectionLevel": "H"
54
+ }
55
+ }
56
+ ]