Skip to content

Commit 2f7db28

Browse files
committed
📦 Release v3.12.0
1 parent 16c6fe7 commit 2f7db28

20 files changed

Lines changed: 397 additions & 2401 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Download or get the CDN link to the script:
135135

136136
| Name | Supported barcodes | Size (gzip) | CDN / Download |
137137
|------|--------------------|:-----------:|---------------:|
138-
| *All* | *All the barcodes!* | *10.1 kB* | *[JsBarcode.all.min.js][1]* |
138+
| *All* | *All the barcodes!* | *5.1 kB* | *[JsBarcode.all.min.js][1]* |
139139
| CODE128 | CODE128 (auto and force mode) | 6.2 kB | [JsBarcode.code128.min.js][2] |
140140
| CODE39 | CODE39 | 5.1 kB | [JsBarcode.code39.min.js][3] |
141141
| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 6.6 kB | [JsBarcode.ean-upc.min.js][4] |

bin/barcodes/CODE93/CODE93.js

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8+
9+
var _constants = require('./constants');
10+
11+
var _Barcode2 = require('../Barcode.js');
12+
13+
var _Barcode3 = _interopRequireDefault(_Barcode2);
14+
15+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16+
17+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18+
19+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
20+
21+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation:
22+
// https://en.wikipedia.org/wiki/Code_93#Detailed_outline
23+
24+
var CODE93 = function (_Barcode) {
25+
_inherits(CODE93, _Barcode);
26+
27+
function CODE93(data, options) {
28+
_classCallCheck(this, CODE93);
29+
30+
return _possibleConstructorReturn(this, (CODE93.__proto__ || Object.getPrototypeOf(CODE93)).call(this, data, options));
31+
}
32+
33+
_createClass(CODE93, [{
34+
key: 'valid',
35+
value: function valid() {
36+
return (/^[0-9A-Z\-. $/+%]+$/.test(this.data)
37+
);
38+
}
39+
}, {
40+
key: 'encode',
41+
value: function encode() {
42+
var symbols = this.data.split('').flatMap(function (c) {
43+
return _constants.MULTI_SYMBOLS[c] || c;
44+
});
45+
var encoded = symbols.map(function (s) {
46+
return CODE93.getEncoding(s);
47+
}).join('');
48+
49+
// Compute checksum symbols
50+
var csumC = CODE93.checksum(symbols, 20);
51+
var csumK = CODE93.checksum(symbols.concat(csumC), 15);
52+
53+
return {
54+
text: this.text,
55+
data:
56+
// Add the start bits
57+
CODE93.getEncoding('\xff') +
58+
// Add the encoded bits
59+
encoded +
60+
// Add the checksum
61+
CODE93.getEncoding(csumC) + CODE93.getEncoding(csumK) +
62+
// Add the stop bits
63+
CODE93.getEncoding('\xff') +
64+
// Add the termination bit
65+
'1'
66+
};
67+
}
68+
69+
// Get the binary encoding of a symbol
70+
71+
}], [{
72+
key: 'getEncoding',
73+
value: function getEncoding(symbol) {
74+
return _constants.BINARIES[CODE93.symbolValue(symbol)];
75+
}
76+
77+
// Get the symbol for a symbol value
78+
79+
}, {
80+
key: 'getSymbol',
81+
value: function getSymbol(symbolValue) {
82+
return _constants.SYMBOLS[symbolValue];
83+
}
84+
85+
// Get the symbol value of a symbol
86+
87+
}, {
88+
key: 'symbolValue',
89+
value: function symbolValue(symbol) {
90+
return _constants.SYMBOLS.indexOf(symbol);
91+
}
92+
93+
// Calculate a checksum symbol
94+
95+
}, {
96+
key: 'checksum',
97+
value: function checksum(symbols, maxWeight) {
98+
var csum = symbols.slice().reverse().reduce(function (sum, symbol, idx) {
99+
var weight = idx % maxWeight + 1;
100+
return sum + CODE93.symbolValue(symbol) * weight;
101+
}, 0);
102+
103+
return CODE93.getSymbol(csum % 47);
104+
}
105+
}]);
106+
107+
return CODE93;
108+
}(_Barcode3.default);
109+
110+
exports.default = CODE93;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8+
9+
var _CODE2 = require('./CODE93.js');
10+
11+
var _CODE3 = _interopRequireDefault(_CODE2);
12+
13+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14+
15+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16+
17+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
18+
19+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
20+
// https://en.wikipedia.org/wiki/Code_93#Full_ASCII_Code_93
21+
22+
var CODE93FullASCII = function (_CODE) {
23+
_inherits(CODE93FullASCII, _CODE);
24+
25+
function CODE93FullASCII(data, options) {
26+
_classCallCheck(this, CODE93FullASCII);
27+
28+
return _possibleConstructorReturn(this, (CODE93FullASCII.__proto__ || Object.getPrototypeOf(CODE93FullASCII)).call(this, data, options));
29+
}
30+
31+
_createClass(CODE93FullASCII, [{
32+
key: 'valid',
33+
value: function valid() {
34+
return (/^[\x00-\x7f]+$/.test(this.data)
35+
);
36+
}
37+
}]);
38+
39+
return CODE93FullASCII;
40+
}(_CODE3.default);
41+
42+
exports.default = CODE93FullASCII;

bin/barcodes/CODE93/constants.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
// The position in the array is the (checksum) value
7+
var SYMBOLS = exports.SYMBOLS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%',
8+
// Only used for csum and multi-symbols character encodings
9+
'($)', '(%)', '(/)', '(+)',
10+
// Start/Stop
11+
'\xff'];
12+
13+
// Order matches SYMBOLS array
14+
var BINARIES = exports.BINARIES = ['100010100', '101001000', '101000100', '101000010', '100101000', '100100100', '100100010', '101010000', '100010010', '100001010', '110101000', '110100100', '110100010', '110010100', '110010010', '110001010', '101101000', '101100100', '101100010', '100110100', '100011010', '101011000', '101001100', '101000110', '100101100', '100010110', '110110100', '110110010', '110101100', '110100110', '110010110', '110011010', '101101100', '101100110', '100110110', '100111010', '100101110', '111010100', '111010010', '111001010', '101101110', '101110110', '110101110', '100100110', '111011010', '111010110', '100110010', '101011110'];
15+
16+
// Multi-symbol characters (Full ASCII Code 93)
17+
var MULTI_SYMBOLS = exports.MULTI_SYMBOLS = {
18+
'\x00': ['(%)', 'U'],
19+
'\x01': ['($)', 'A'],
20+
'\x02': ['($)', 'B'],
21+
'\x03': ['($)', 'C'],
22+
'\x04': ['($)', 'D'],
23+
'\x05': ['($)', 'E'],
24+
'\x06': ['($)', 'F'],
25+
'\x07': ['($)', 'G'],
26+
'\x08': ['($)', 'H'],
27+
'\x09': ['($)', 'I'],
28+
'\x0a': ['($)', 'J'],
29+
'\x0b': ['($)', 'K'],
30+
'\x0c': ['($)', 'L'],
31+
'\x0d': ['($)', 'M'],
32+
'\x0e': ['($)', 'N'],
33+
'\x0f': ['($)', 'O'],
34+
'\x10': ['($)', 'P'],
35+
'\x11': ['($)', 'Q'],
36+
'\x12': ['($)', 'R'],
37+
'\x13': ['($)', 'S'],
38+
'\x14': ['($)', 'T'],
39+
'\x15': ['($)', 'U'],
40+
'\x16': ['($)', 'V'],
41+
'\x17': ['($)', 'W'],
42+
'\x18': ['($)', 'X'],
43+
'\x19': ['($)', 'Y'],
44+
'\x1a': ['($)', 'Z'],
45+
'\x1b': ['(%)', 'A'],
46+
'\x1c': ['(%)', 'B'],
47+
'\x1d': ['(%)', 'C'],
48+
'\x1e': ['(%)', 'D'],
49+
'\x1f': ['(%)', 'E'],
50+
'!': ['(/)', 'A'],
51+
'"': ['(/)', 'B'],
52+
'#': ['(/)', 'C'],
53+
'&': ['(/)', 'F'],
54+
'\'': ['(/)', 'G'],
55+
'(': ['(/)', 'H'],
56+
')': ['(/)', 'I'],
57+
'*': ['(/)', 'J'],
58+
',': ['(/)', 'L'],
59+
':': ['(/)', 'Z'],
60+
';': ['(%)', 'F'],
61+
'<': ['(%)', 'G'],
62+
'=': ['(%)', 'H'],
63+
'>': ['(%)', 'I'],
64+
'?': ['(%)', 'J'],
65+
'@': ['(%)', 'V'],
66+
'[': ['(%)', 'K'],
67+
'\\': ['(%)', 'L'],
68+
']': ['(%)', 'M'],
69+
'^': ['(%)', 'N'],
70+
'_': ['(%)', 'O'],
71+
'`': ['(%)', 'W'],
72+
'a': ['(+)', 'A'],
73+
'b': ['(+)', 'B'],
74+
'c': ['(+)', 'C'],
75+
'd': ['(+)', 'D'],
76+
'e': ['(+)', 'E'],
77+
'f': ['(+)', 'F'],
78+
'g': ['(+)', 'G'],
79+
'h': ['(+)', 'H'],
80+
'i': ['(+)', 'I'],
81+
'j': ['(+)', 'J'],
82+
'k': ['(+)', 'K'],
83+
'l': ['(+)', 'L'],
84+
'm': ['(+)', 'M'],
85+
'n': ['(+)', 'N'],
86+
'o': ['(+)', 'O'],
87+
'p': ['(+)', 'P'],
88+
'q': ['(+)', 'Q'],
89+
'r': ['(+)', 'R'],
90+
's': ['(+)', 'S'],
91+
't': ['(+)', 'T'],
92+
'u': ['(+)', 'U'],
93+
'v': ['(+)', 'V'],
94+
'w': ['(+)', 'W'],
95+
'x': ['(+)', 'X'],
96+
'y': ['(+)', 'Y'],
97+
'z': ['(+)', 'Z'],
98+
'{': ['(%)', 'P'],
99+
'|': ['(%)', 'Q'],
100+
'}': ['(%)', 'R'],
101+
'~': ['(%)', 'S'],
102+
'\x7f': ['(%)', 'T']
103+
};

bin/barcodes/CODE93/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.CODE93FullASCII = exports.CODE93 = undefined;
7+
8+
var _CODE = require('./CODE93.js');
9+
10+
var _CODE2 = _interopRequireDefault(_CODE);
11+
12+
var _CODE93FullASCII = require('./CODE93FullASCII.js');
13+
14+
var _CODE93FullASCII2 = _interopRequireDefault(_CODE93FullASCII);
15+
16+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17+
18+
exports.CODE93 = _CODE2.default;
19+
exports.CODE93FullASCII = _CODE93FullASCII2.default;

bin/barcodes/index.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
'use strict';
22

33
Object.defineProperty(exports, "__esModule", {
4-
value: true
4+
value: true
55
});
66

7-
var _CODE = require('./CODE39/');
7+
var _CODE = require('./CODE39');
88

9-
var _CODE2 = require('./CODE128/');
10-
11-
var _EAN_UPC = require('./EAN_UPC/');
12-
13-
var _ITF = require('./ITF/');
14-
15-
var _MSI = require('./MSI/');
16-
17-
var _pharmacode = require('./pharmacode/');
18-
19-
var _codabar = require('./codabar');
20-
21-
var _GenericBarcode = require('./GenericBarcode/');
22-
23-
exports.default = {
24-
CODE39: _CODE.CODE39,
25-
CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
26-
EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
27-
ITF14: _ITF.ITF14,
28-
ITF: _ITF.ITF,
29-
MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
30-
pharmacode: _pharmacode.pharmacode,
31-
codabar: _codabar.codabar,
32-
GenericBarcode: _GenericBarcode.GenericBarcode
33-
};
9+
exports.default = { CODE39: _CODE.CODE39 };

bin/barcodes/index.tmp.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
'use strict';
22

33
Object.defineProperty(exports, "__esModule", {
4-
value: true
4+
value: true
55
});
66

7-
var _CODE = require('./CODE39/');
7+
var _CODE = require('./CODE39');
88

9-
var _CODE2 = require('./CODE128/');
10-
11-
var _EAN_UPC = require('./EAN_UPC/');
12-
13-
var _ITF = require('./ITF/');
14-
15-
var _MSI = require('./MSI/');
16-
17-
var _pharmacode = require('./pharmacode/');
18-
19-
var _codabar = require('./codabar');
20-
21-
var _GenericBarcode = require('./GenericBarcode/');
22-
23-
exports.default = {
24-
CODE39: _CODE.CODE39,
25-
CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
26-
EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC, UPCE: _EAN_UPC.UPCE,
27-
ITF14: _ITF.ITF14,
28-
ITF: _ITF.ITF,
29-
MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
30-
pharmacode: _pharmacode.pharmacode,
31-
codabar: _codabar.codabar,
32-
GenericBarcode: _GenericBarcode.GenericBarcode
33-
};
9+
exports.default = { CODE39: _CODE.CODE39 };

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "JsBarcode",
33
"main": "dist/JsBarcode.all.min.js",
4-
"version": "3.11.6",
4+
"version": "3.12.0",
55
"homepage": "https://github.com/lindell/JsBarcode",
66
"authors": [
77
"Johan Lindell <johan@lindell.me>"
88
],
99
"description": "JsBarcode is a simple way to create different types of 1d barcodes.",
1010
"repository": {
11-
"type": "git",
12-
"url": "git://github.com/lindell/JsBarcode"
11+
"type": "git",
12+
"url": "git://github.com/lindell/JsBarcode"
1313
},
1414
"moduleType": [
1515
"globals"

0 commit comments

Comments
 (0)