Barcode Generation
This commit is contained in:
74
node_modules/jsbarcode/bin/barcodes/MSI/MSI.js
generated
vendored
Executable file
74
node_modules/jsbarcode/bin/barcodes/MSI/MSI.js
generated
vendored
Executable file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
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; }; }();
|
||||
|
||||
var _Barcode2 = require("../Barcode.js");
|
||||
|
||||
var _Barcode3 = _interopRequireDefault(_Barcode2);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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; }
|
||||
|
||||
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
|
||||
// https://en.wikipedia.org/wiki/MSI_Barcode#Character_set_and_binary_lookup
|
||||
|
||||
var MSI = function (_Barcode) {
|
||||
_inherits(MSI, _Barcode);
|
||||
|
||||
function MSI(data, options) {
|
||||
_classCallCheck(this, MSI);
|
||||
|
||||
return _possibleConstructorReturn(this, (MSI.__proto__ || Object.getPrototypeOf(MSI)).call(this, data, options));
|
||||
}
|
||||
|
||||
_createClass(MSI, [{
|
||||
key: "encode",
|
||||
value: function encode() {
|
||||
// Start bits
|
||||
var ret = "110";
|
||||
|
||||
for (var i = 0; i < this.data.length; i++) {
|
||||
// Convert the character to binary (always 4 binary digits)
|
||||
var digit = parseInt(this.data[i]);
|
||||
var bin = digit.toString(2);
|
||||
bin = addZeroes(bin, 4 - bin.length);
|
||||
|
||||
// Add 100 for every zero and 110 for every 1
|
||||
for (var b = 0; b < bin.length; b++) {
|
||||
ret += bin[b] == "0" ? "100" : "110";
|
||||
}
|
||||
}
|
||||
|
||||
// End bits
|
||||
ret += "1001";
|
||||
|
||||
return {
|
||||
data: ret,
|
||||
text: this.text
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "valid",
|
||||
value: function valid() {
|
||||
return this.data.search(/^[0-9]+$/) !== -1;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MSI;
|
||||
}(_Barcode3.default);
|
||||
|
||||
function addZeroes(number, n) {
|
||||
for (var i = 0; i < n; i++) {
|
||||
number = "0" + number;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
exports.default = MSI;
|
||||
33
node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js
generated
vendored
Executable file
33
node_modules/jsbarcode/bin/barcodes/MSI/MSI10.js
generated
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _MSI2 = require('./MSI.js');
|
||||
|
||||
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||
|
||||
var _checksums = require('./checksums.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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; }
|
||||
|
||||
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; }
|
||||
|
||||
var MSI10 = function (_MSI) {
|
||||
_inherits(MSI10, _MSI);
|
||||
|
||||
function MSI10(data, options) {
|
||||
_classCallCheck(this, MSI10);
|
||||
|
||||
return _possibleConstructorReturn(this, (MSI10.__proto__ || Object.getPrototypeOf(MSI10)).call(this, data + (0, _checksums.mod10)(data), options));
|
||||
}
|
||||
|
||||
return MSI10;
|
||||
}(_MSI3.default);
|
||||
|
||||
exports.default = MSI10;
|
||||
35
node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js
generated
vendored
Executable file
35
node_modules/jsbarcode/bin/barcodes/MSI/MSI1010.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _MSI2 = require('./MSI.js');
|
||||
|
||||
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||
|
||||
var _checksums = require('./checksums.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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; }
|
||||
|
||||
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; }
|
||||
|
||||
var MSI1010 = function (_MSI) {
|
||||
_inherits(MSI1010, _MSI);
|
||||
|
||||
function MSI1010(data, options) {
|
||||
_classCallCheck(this, MSI1010);
|
||||
|
||||
data += (0, _checksums.mod10)(data);
|
||||
data += (0, _checksums.mod10)(data);
|
||||
return _possibleConstructorReturn(this, (MSI1010.__proto__ || Object.getPrototypeOf(MSI1010)).call(this, data, options));
|
||||
}
|
||||
|
||||
return MSI1010;
|
||||
}(_MSI3.default);
|
||||
|
||||
exports.default = MSI1010;
|
||||
33
node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js
generated
vendored
Executable file
33
node_modules/jsbarcode/bin/barcodes/MSI/MSI11.js
generated
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _MSI2 = require('./MSI.js');
|
||||
|
||||
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||
|
||||
var _checksums = require('./checksums.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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; }
|
||||
|
||||
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; }
|
||||
|
||||
var MSI11 = function (_MSI) {
|
||||
_inherits(MSI11, _MSI);
|
||||
|
||||
function MSI11(data, options) {
|
||||
_classCallCheck(this, MSI11);
|
||||
|
||||
return _possibleConstructorReturn(this, (MSI11.__proto__ || Object.getPrototypeOf(MSI11)).call(this, data + (0, _checksums.mod11)(data), options));
|
||||
}
|
||||
|
||||
return MSI11;
|
||||
}(_MSI3.default);
|
||||
|
||||
exports.default = MSI11;
|
||||
35
node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js
generated
vendored
Executable file
35
node_modules/jsbarcode/bin/barcodes/MSI/MSI1110.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _MSI2 = require('./MSI.js');
|
||||
|
||||
var _MSI3 = _interopRequireDefault(_MSI2);
|
||||
|
||||
var _checksums = require('./checksums.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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; }
|
||||
|
||||
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; }
|
||||
|
||||
var MSI1110 = function (_MSI) {
|
||||
_inherits(MSI1110, _MSI);
|
||||
|
||||
function MSI1110(data, options) {
|
||||
_classCallCheck(this, MSI1110);
|
||||
|
||||
data += (0, _checksums.mod11)(data);
|
||||
data += (0, _checksums.mod10)(data);
|
||||
return _possibleConstructorReturn(this, (MSI1110.__proto__ || Object.getPrototypeOf(MSI1110)).call(this, data, options));
|
||||
}
|
||||
|
||||
return MSI1110;
|
||||
}(_MSI3.default);
|
||||
|
||||
exports.default = MSI1110;
|
||||
29
node_modules/jsbarcode/bin/barcodes/MSI/checksums.js
generated
vendored
Executable file
29
node_modules/jsbarcode/bin/barcodes/MSI/checksums.js
generated
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.mod10 = mod10;
|
||||
exports.mod11 = mod11;
|
||||
function mod10(number) {
|
||||
var sum = 0;
|
||||
for (var i = 0; i < number.length; i++) {
|
||||
var n = parseInt(number[i]);
|
||||
if ((i + number.length) % 2 === 0) {
|
||||
sum += n;
|
||||
} else {
|
||||
sum += n * 2 % 10 + Math.floor(n * 2 / 10);
|
||||
}
|
||||
}
|
||||
return (10 - sum % 10) % 10;
|
||||
}
|
||||
|
||||
function mod11(number) {
|
||||
var sum = 0;
|
||||
var weights = [2, 3, 4, 5, 6, 7];
|
||||
for (var i = 0; i < number.length; i++) {
|
||||
var n = parseInt(number[number.length - 1 - i]);
|
||||
sum += weights[i % weights.length] * n;
|
||||
}
|
||||
return (11 - sum % 11) % 11;
|
||||
}
|
||||
34
node_modules/jsbarcode/bin/barcodes/MSI/index.js
generated
vendored
Normal file
34
node_modules/jsbarcode/bin/barcodes/MSI/index.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MSI1110 = exports.MSI1010 = exports.MSI11 = exports.MSI10 = exports.MSI = undefined;
|
||||
|
||||
var _MSI = require('./MSI.js');
|
||||
|
||||
var _MSI2 = _interopRequireDefault(_MSI);
|
||||
|
||||
var _MSI3 = require('./MSI10.js');
|
||||
|
||||
var _MSI4 = _interopRequireDefault(_MSI3);
|
||||
|
||||
var _MSI5 = require('./MSI11.js');
|
||||
|
||||
var _MSI6 = _interopRequireDefault(_MSI5);
|
||||
|
||||
var _MSI7 = require('./MSI1010.js');
|
||||
|
||||
var _MSI8 = _interopRequireDefault(_MSI7);
|
||||
|
||||
var _MSI9 = require('./MSI1110.js');
|
||||
|
||||
var _MSI10 = _interopRequireDefault(_MSI9);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.MSI = _MSI2.default;
|
||||
exports.MSI10 = _MSI4.default;
|
||||
exports.MSI11 = _MSI6.default;
|
||||
exports.MSI1010 = _MSI8.default;
|
||||
exports.MSI1110 = _MSI10.default;
|
||||
Reference in New Issue
Block a user