CODE128B.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 'use strict';
  2. var _createClass = function() {
  3. function defineProperties(target, props) {
  4. for (var i = 0; i < props.length; i++) {
  5. var descriptor = props[i];
  6. descriptor.enumerable = descriptor.enumerable || false;
  7. descriptor.configurable = true;
  8. if ("value" in descriptor) descriptor.writable = true;
  9. Object.defineProperty(target, descriptor.key, descriptor);
  10. }
  11. }
  12. return function(Constructor, protoProps, staticProps) {
  13. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  14. if (staticProps) defineProperties(Constructor, staticProps);
  15. return Constructor;
  16. };
  17. }();
  18. import _CODE3 from './CODE128'
  19. import _constants from './constants'
  20. function _interopRequireDefault(obj) {
  21. return obj && obj.__esModule ? obj : {
  22. default: obj
  23. };
  24. }
  25. function _classCallCheck(instance, Constructor) {
  26. if (!(instance instanceof Constructor)) {
  27. throw new TypeError("Cannot call a class as a function");
  28. }
  29. }
  30. function _possibleConstructorReturn(self, call) {
  31. if (!self) {
  32. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  33. }
  34. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  35. }
  36. function _inherits(subClass, superClass) {
  37. if (typeof superClass !== "function" && superClass !== null) {
  38. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  39. }
  40. subClass.prototype = Object.create(superClass && superClass.prototype, {
  41. constructor: {
  42. value: subClass,
  43. enumerable: false,
  44. writable: true,
  45. configurable: true
  46. }
  47. });
  48. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ =
  49. superClass;
  50. }
  51. var CODE128B = function(_CODE) {
  52. _inherits(CODE128B, _CODE);
  53. function CODE128B(string, options) {
  54. _classCallCheck(this, CODE128B);
  55. return _possibleConstructorReturn(this, (CODE128B.__proto__ || Object.getPrototypeOf(CODE128B)).call(this,
  56. _constants.B_START_CHAR + string, options));
  57. }
  58. _createClass(CODE128B, [{
  59. key: 'valid',
  60. value: function valid() {
  61. return new RegExp('^' + _constants.B_CHARS + '+$').test(this.data);
  62. }
  63. }]);
  64. return CODE128B;
  65. }(_CODE3);
  66. export default CODE128B;